Template
Remove next/cache usage (use cache, cacheLife, cacheTag, cacheComponents)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F22Ms5Cxam5UHyxaCrtZzu
This commit is contained in:
co-authored by
Claude Fable 5
parent
f23332e42c
commit
1e58ba4ca4
+2
-8
@@ -1,5 +1,4 @@
|
||||
import type { MetadataRoute } from "next";
|
||||
import { cacheLife, cacheTag } from "next/cache";
|
||||
|
||||
import { SITEMAP_QUERY } from "@/lib/queries";
|
||||
import { SITE_ORIGIN } from "@/lib/site";
|
||||
@@ -7,9 +6,8 @@ import { staticStorefrontClient } from "@/lib/storefront-static";
|
||||
|
||||
/**
|
||||
* `/sitemap.xml` (engineering.md F10). Lists product + collection URLs with
|
||||
* `updatedAt` timestamps, fetched via the shared `staticStorefrontClient`
|
||||
* inside a `use cache` cache-point (catalog, not personalized). mock.shop
|
||||
* fallback works (queries mock.shop).
|
||||
* `updatedAt` timestamps, fetched via the shared `staticStorefrontClient`.
|
||||
* mock.shop fallback works (queries mock.shop).
|
||||
*/
|
||||
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||
const entries = await fetchSitemap();
|
||||
@@ -23,10 +21,6 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||
type SitemapEntry = { loc: string; lastmod?: string };
|
||||
|
||||
async function fetchSitemap(): Promise<SitemapEntry[]> {
|
||||
"use cache";
|
||||
cacheLife("hours");
|
||||
cacheTag("products", "collections");
|
||||
|
||||
const { data, errors } = await staticStorefrontClient.graphql(SITEMAP_QUERY);
|
||||
if (errors) {
|
||||
console.error("[hydrogen] Sitemap query failed", errors);
|
||||
|
||||
Reference in New Issue
Block a user