Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynamic route configuration for products page #396

Open
ouestlabs opened this issue Nov 11, 2024 · 3 comments
Open

Add dynamic route configuration for products page #396

ouestlabs opened this issue Nov 11, 2024 · 3 comments
Assignees

Comments

@ouestlabs
Copy link

The storefront currently experiences caching issues with product pages in production environments. To resolve this, we need to add the dynamic = "force-dynamic" export configuration in the products route.

Proposed Changes

Add the following configuration to /src/app/[countryCode]/(main)/products/[handle]/page.tsx:

// ... existing imports ...

// Add this line at the top of the file
export const dynamic = "force-dynamic"

// ... rest of the file remains unchanged ...

Why

  • Prevents unwanted caching behavior in production environments
  • Ensures product data is always fresh and up-to-date
  • Fixes issues with product page rendering in hosted environments (e.g., Vercel, Railway)

Additional Context

This is a recommended approach for handling dynamic routes in Next.js App Router, particularly for catch-all routes that need fresh data on each request.

@fPolic
Copy link
Collaborator

fPolic commented Nov 12, 2024

hey @ouestlabs thanks for the report. Would you be up for opening a PR for this one?

@ouestlabs
Copy link
Author

hey @ouestlabs thanks for the report. Would you be up for opening a PR for this one?

Hey @fPolic sure

@ouestlabs
Copy link
Author

PR: #399

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants