mirror of
https://github.com/vercel/commerce.git
synced 2025-06-07 08:46:58 +00:00
This commit resolves the Vercel build error: "Error: The 'use cache' directive must be at the top of the function body." The following functions in `lib/shopify/index.ts` were updated to ensure that if they use Next.js caching, the `'use cache';` directive is the very first statement in the function body, preceding any conditional logic for dummy data mode: - `getCollection` - `getCollectionProducts` - `getCollections` - `getProduct` - `getProducts` - `getProductRecommendations` Additionally, dummy data mode handling was added to `getProductRecommendations` to align with other data fetching functions. Functions fully converted to dummy data providers (like `getMenu` and `getCart` when in dummy mode) were confirmed to not use these directives, which is correct.