Skip to content

Commit

Permalink
fix(gatsby): Add back missing partial hydration error handling change (
Browse files Browse the repository at this point in the history
  • Loading branch information
tyhopp committed Sep 23, 2022
1 parent 17a776d commit a629551
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/gatsby-cli/src/structured-errors/error-map.ts
Expand Up @@ -772,7 +772,7 @@ const errors = {
"80000": {
text: (context): string =>
stripIndents(`Building partial HTML failed${
context.path ? ` for path "${context.path}"` : ``
context?.path ? ` for path "${context.path}"` : ``
}
This can happen if interactive elements like "useEffect", "useState", "createContext" or event handlers are used in a component without declaring the "client export" directive at the top of the file.
Expand Down
29 changes: 13 additions & 16 deletions packages/gatsby/src/commands/build-html.ts
Expand Up @@ -463,23 +463,20 @@ const renderPartialHydrationQueue = async (
const sessionId = Date.now()
// const { webpackCompilationHash } = store.getState()

try {
await Promise.all(
segments.map(async pageSegment => {
await workerPool.single.renderPartialHydrationProd({
envVars,
paths: pageSegment,
sessionId,
})

if (activity && activity.tick) {
activity.tick(pageSegment.length)
}
// Let the error bubble up
await Promise.all(
segments.map(async pageSegment => {
await workerPool.single.renderPartialHydrationProd({
envVars,
paths: pageSegment,
sessionId,
})
)
} catch (e) {
console.log({ e })
}

if (activity && activity.tick) {
activity.tick(pageSegment.length)
}
})
)
}

class BuildHTMLError extends Error {
Expand Down

0 comments on commit a629551

Please sign in to comment.