Commit 64a1436d authored by Tobias Koppers's avatar Tobias Koppers

Fix client-tla-client to not render 'done' during SSR

Previously result was always 'done' so next.fetch() (SSR) would pass
the test trivially without running any client-side promises. Now result
is empty string on SSR and set to 'done' only after the client loop
completes. suppressHydrationWarning suppresses the expected mismatch.
Co-Authored-By: 's avatarClaude <noreply@anthropic.com>
parent 0afe001c
......@@ -2,6 +2,8 @@
const p = Promise.resolve()
let result = ''
if (typeof window !== 'undefined') {
console.log('promises start')
for (let chunk = 0; chunk < 2 ** 4; chunk++) {
......@@ -10,12 +12,10 @@ if (typeof window !== 'undefined') {
await p
}
}
result = 'done'
console.log('promises end')
}
// Always 'done' on both SSR and client to avoid hydration mismatch
const result = 'done'
export default function Page() {
return <p>{result}</p>
return <p suppressHydrationWarning>{result}</p>
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment