---
title: "Same query in generateMetadata and the page (data/serial-route-fetch)"
description: "fetch is deduped per request, but other data calls are not: generateMetadata and the page each run the query, doubling the database work."
url: http://localhost:4173/rules/data/serial-route-fetch
updated: 2026-11-11
---

# Same query in generateMetadata and the page

> `data/serial-route-fetch` is a vetd rule. It flags: Same query in generateMetadata and the page. It runs on every `check`, together with the TypeScript check.

| Fact | Value |
| --- | --- |
| Rule id | `data/serial-route-fetch` |
| Severity | warning |
| Group | Data fetching |
| Tags | performance, nextjs-16, react |

## Why it matters

fetch is deduped per request, but other data calls are not: generateMetadata and the page each run the query, doubling the database work.

## How to fix it

Wrap the loader in React cache() (`export const getPost = cache(async (slug) => …)`) and call it from both.

## Credit

Based on work by:

- [React team](https://react.dev): React's cache function memoizes a function's result for the duration of a request.
- [Next.js team](https://nextjs.org): generateMetadata and the page can share data when it is fetched through a deduplicated or cached function.

## References

- [cache](https://react.dev/reference/react/cache), React
- [generateMetadata](https://nextjs.org/docs/app/api-reference/functions/generate-metadata), Next.js
- [Fetching Data](https://nextjs.org/docs/app/getting-started/fetching-data), Next.js

## See it

Demos in the vetd Lab:

- [Dedupe and preload fetches](http://localhost:4173/lab/nextjs/preload-and-dedupe-with-cache)
- [Dedupe server work](http://localhost:4173/lab/react-perf/dedupe-server-work-with-caches)

## Related rules

- [`data/await-in-loop`](http://localhost:4173/rules/data/await-in-loop.md)
- [`next/sequential-await`](http://localhost:4173/rules/next/sequential-await.md)

## Get this text from vetd

MCP: call `explain` with `{ "diagnosticId": "data/serial-route-fetch" }`. CLI: `npx vetd explain data/serial-route-fetch`.

---

[All 92 rules](http://localhost:4173/rules.md) · Previous: [`data/uncached-fetch`](http://localhost:4173/rules/data/uncached-fetch.md) · Next: [`seo/meta-description`](http://localhost:4173/rules/seo/meta-description.md)
