Side effect of third argument of preact render #7868
Labels
- P4: important
Violate documented behavior or significantly impacts performance (priority)
pkg: preact
Related to Preact (scope)
What version of
astro
are you using?2.9.5
Are you using an SSR adapter? If so, which one?
node
What package manager are you using?
pnpm
What operating system are you using?
mac
What browser are you using?
chrome
Describe the Bug
I saw PR of @matthewp when third argument was added to Preact
render
. It was solving problem with doubles of child nodes.But now i see new problem, when i try to use
Suspense
. It happens because third argument inrender
tells Preact, thatisHydrate
mode is not now.So, preact considered we have not hydrate and
Suspense
component showsFallback
component which was passed toLazy
. With third argument of render in app it displays fast turning ofhtml mark from server
->html mark of suspense fallback
->hydrated html mark
. I expect, thathtml mark of suspense fallback
will have never seen during hydration.Preact source code has comment about this:
If Preact knew we are staying in
isHydrate
mode, it would not showFallback
componentCan we fix it?
Can we solve problem with doubles element another method? I tried to return old behavior, when we had two arguments for Preact
render
and all tests passed.Also one reason, why we need to use two arguments instead three - calling of render with three arguments have marked as deprecated and this possibility will be removed in next Preact version
How to reproduce it
Supporting of Suspense and Lazy component have not still approved yet. I hope, my pr will be included at close time. For reproducing problem with three arguments of render, you need to move to branch with supporting of
Suspense
:And you may see, that
Fallback
ofSuspense
have been showed one time#5937
What's the expected result?
Fallback
component ofSuspense
will never show while hydratingLink to Minimal Reproducible Example
https://github.com/aleksandrjet/astro/tree/preact-prepass-render
Participation
The text was updated successfully, but these errors were encountered: