Skip to content

Commit

Permalink
fix: remove revalidate from cart requests
Browse files Browse the repository at this point in the history
  • Loading branch information
VariableVic committed May 11, 2023
1 parent cd2db81 commit 4639520
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/[page]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { notFound } from 'next/navigation';

export const runtime = 'edge';

export const revalidate = 43200; // 12 hours in seconds
export const revalidate = parseInt(process.env.REVALIDATE_WINDOW ?? `${60 * 60 * 12}`); // 12 hours

export async function generateMetadata({
params
Expand Down
1 change: 0 additions & 1 deletion app/search/[collection]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Grid from 'components/grid';
import ProductGridItems from 'components/layout/product-grid-items';

export const runtime = 'edge';
export const revalidate = 30;

export async function generateMetadata({
params
Expand Down
7 changes: 5 additions & 2 deletions lib/medusa/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ export default async function medusaRequest(
headers: {
'Content-Type': 'application/json',
'x-publishable-key': MEDUSA_API_KEY
},
next: { revalidate: REVALIDATE_WINDOW }
}
};

if (!path.includes('/carts')) {
options.next = { revalidate: REVALIDATE_WINDOW };
}

if (payload) {
options.body = JSON.stringify(payload);
}
Expand Down

0 comments on commit 4639520

Please sign in to comment.