Skip to content

Commit

Permalink
fix(core): fix preview mode with a dynamic route is used (#1585)
Browse files Browse the repository at this point in the history
When route was dynamic e.g. ``[[...slug]]` data and page routes would return the SSG content, rather than the SSR.

Added `&& !isPreview` to ensure it matches the same logic as non dynamic routes.

Fixes #1527
  • Loading branch information
J3tto committed Aug 25, 2021
1 parent 96892d9 commit 316bd2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/libs/core/src/route/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const handleDataReq = (
const dynamic = matchDynamicRoute(localeUri, pages.dynamic);

const dynamicSSG = dynamic && pages.ssg.dynamic[dynamic];
if (dynamicSSG) {
if (dynamicSSG && !isPreview) {
return {
isData: true,
isStatic: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/libs/core/src/route/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const handlePageReq = (
const dynamic = matchDynamicRoute(localeUri, pages.dynamic);

const dynamicSSG = dynamic && pages.ssg.dynamic[dynamic];
if (dynamicSSG) {
if (dynamicSSG && !isPreview) {
return {
isData: false,
isStatic: true,
Expand Down

0 comments on commit 316bd2a

Please sign in to comment.