You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check if updating to the latest Preact version resolves the issue
Describe the bug
We use ErrorBoundary and lazy from preact-iso for code-splitting our application but still being able to server-side render them in advance. With the upgrade to >10.19.0, we noticed that all our lazy components are rendered twice when first server-side rendered.
One important thing to note is that we use render instead of hydrate for hydrating our server-side rendered HTML because the server-side markup differs from what we render on the client. The bug does not appear when using hydrate. But changing that behaviour in our application would take an immense effort.
Switching from ErrorBoundary to Suspense did not solve the bug.
Hmm, this seems related to #4180 what seems to happen is that we opt out of resumed hydration due to leveraging render. When we initiate render we correctly re-use the initial components until we hit the lazy-boundary, it bubbles up the Promise to the error-boundary/suspense and then fails to recover the correct oldDom instead we are looking at either nothing or a disconnected node (the fallback) which is not dissimilar to what we've seen in other issues relating to Suspense.
I agree that we def should not duplicate the UI, I currently can't look at this but this can probably be reproduced in tests.
Describe the bug
We use
ErrorBoundary
andlazy
from preact-iso for code-splitting our application but still being able to server-side render them in advance. With the upgrade to >10.19.0, we noticed that all our lazy components are rendered twice when first server-side rendered.One important thing to note is that we use
render
instead ofhydrate
for hydrating our server-side rendered HTML because the server-side markup differs from what we render on the client. The bug does not appear when usinghydrate
. But changing that behaviour in our application would take an immense effort.Switching from
ErrorBoundary
toSuspense
did not solve the bug.To Reproduce
Here is the same bug with
Suspense
instead ofErrorBoundary
: https://codepen.io/phmitterer/pen/oNrNOVJExpected behavior
"Hello, World!" is only rendered once.
The text was updated successfully, but these errors were encountered: