Skip to content

Commit

Permalink
Adjust invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Jan 23, 2024
1 parent b7521f1 commit 1fa1812
Show file tree
Hide file tree
Showing 4 changed files with 503 additions and 502 deletions.
7 changes: 2 additions & 5 deletions app/api/revalidate/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ export const GET = async (request: NextRequest) => {
if (!path) {
return NextResponse.json({message: 'Missing slug'}, {status: 400});
}
const cacheTag = path.replace(/^\//, '').replaceAll('/', ':');

revalidateTag(cacheTag)
revalidateTag('paths')
revalidateTag('paths');
revalidatePath(path);
return NextResponse.json({revalidated: true, path, tags: [cacheTag, 'paths']});
return NextResponse.json({revalidated: true, path, tags: ['paths']});
}
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dependencies": {
"@formkit/auto-animate": "^0.8.1",
"@heroicons/react": "^2.1.1",
"@mui/base": "^5.0.0-beta.32",
"@mui/base": "^5.0.0-beta.33",
"@tailwindcss/container-queries": "^0.1.1",
"@types/node": "^20.11.5",
"@types/react": "^18.2.48",
Expand All @@ -27,45 +27,45 @@
"decanter": "^7.2.0",
"drupal-jsonapi-params": "^2.3.1",
"eslint": "^8.56.0",
"eslint-config-next": "^14.0.4",
"eslint-config-next": "^14.1.0",
"graphql": "^16.8.1",
"graphql-request": "^6.1.0",
"graphql-tag": "^2.12.6",
"html-entities": "^2.4.0",
"html-react-parser": "^5.1.1",
"next": "^14.0.5-canary.65",
"next": "^14.1.0",
"next-drupal": "^1.6.0",
"nextjs-google-analytics": "^2.3.3",
"postcss": "^8.4.33",
"qs": "^6.11.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-focus-lock": "^2.9.6",
"react-focus-lock": "^2.9.7",
"react-tiny-oembed": "^1.1.0",
"sharp": "^0.33.2",
"tailwind-merge": "^2.2.0",
"tailwind-merge": "^2.2.1",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3",
"usehooks-ts": "^2.9.4"
"usehooks-ts": "^2.9.5"
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.1",
"@graphql-codegen/typescript-graphql-request": "^6.1.0",
"@graphql-codegen/typescript-operations": "^4.1.0",
"@next/bundle-analyzer": "^14.0.4",
"@storybook/addon-essentials": "^7.6.9",
"@storybook/addon-interactions": "^7.6.9",
"@storybook/addon-links": "^7.6.9",
"@next/bundle-analyzer": "^14.1.0",
"@storybook/addon-essentials": "^7.6.10",
"@storybook/addon-interactions": "^7.6.10",
"@storybook/addon-links": "^7.6.10",
"@storybook/addon-styling": "^1.3.7",
"@storybook/blocks": "^7.6.9",
"@storybook/nextjs": "^7.6.9",
"@storybook/react": "^7.6.9",
"@storybook/blocks": "^7.6.10",
"@storybook/nextjs": "^7.6.10",
"@storybook/react": "^7.6.10",
"@storybook/testing-library": "^0.2.2",
"concurrently": "^8.2.2",
"encoding": "^0.1.13",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-unused-imports": "^3.0.0",
"storybook": "^7.6.9"
"storybook": "^7.6.10"
},
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion src/lib/gql/fetcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const getEntityFromPath = cache(async <T extends NodeUnion | TermUnion, >

let query: RouteQuery;
try {
query = await graphqlClient(token?.access_token).Route({path});
query = await graphqlClient(token?.access_token, {next: {tags: [`paths:${path}`]}}).Route({path});
} catch (e) {
console.error(`Error fetching route data for '${path}'. ` + (e instanceof Error && e.message));
return {entity: undefined, redirect: undefined};
Expand Down
Loading

0 comments on commit 1fa1812

Please sign in to comment.