Skip to content

Commit

Permalink
Let's see if noStore could fix the Next.js bug:
Browse files Browse the repository at this point in the history
"Invariant: expected pageData to be a string, got undefined"
  • Loading branch information
benmerckx committed Jan 30, 2024
1 parent 2836466 commit d0f13b6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const external = builtinModules
'next/navigation.js',
'next/dynamic.js',
'next/headers.js',
'next/store.js',
'@remix-run/node',
'@remix-run/react',
'react/jsx-runtime',
Expand Down
6 changes: 0 additions & 6 deletions src/cli/serve/CreateLocalServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ export function createLocalServer(
let currentBuild: Trigger<BuildDetails> = trigger<BuildDetails>(),
initial = true
const config = {
external: [
'next/navigation.js',
'next/dynamic.js',
'next/headers.js',
'@alinea/generated/store.js'
],
format: 'esm',
target: 'esnext',
treeShaking: true,
Expand Down
2 changes: 2 additions & 0 deletions src/core/driver/NextDriver.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class NextDriver extends DefaultDriver implements NextApi {
realm: Realm.Published
}
if (isDraft) {
const {unstable_noStore: noStore} = await import('next/cache.js')
noStore()
resolveDefaults.realm = Realm.PreferDraft
const update = parseChunkedCookies(
PREVIEW_UPDATE_NAME,
Expand Down

0 comments on commit d0f13b6

Please sign in to comment.