Skip to content

Commit

Permalink
Add preview mode to cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Jul 26, 2024
1 parent 1a8609a commit 030f4c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/gql/gql-queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const getEntityFromPath = cache(
if (path.startsWith("/node/")) return {}

try {
query = await graphqlClient({next: {tags: ["all-entities", `paths:${path}`]}}, previewMode).Route({path})
query = await graphqlClient({cache: "no-cache"}, previewMode).Route({path})
} catch (e) {
console.warn(e instanceof Error ? e.message : "An error occurred")
return {entity: undefined, redirect: undefined, error: e instanceof Error ? e.message : "An error occurred"}
Expand All @@ -46,7 +46,7 @@ export const getEntityFromPath = cache(
query.route?.__typename === "RouteInternal" && query.route.entity ? (query.route.entity as T) : undefined
return {entity, redirect: undefined, error: undefined}
},
["entities", path],
["entities", path, previewMode ? "preview" : "anonymous"],
{tags: ["all-entities", `paths:${path}`]}
)

Expand Down

0 comments on commit 030f4c6

Please sign in to comment.