Subscribe on changes!

SSR issue: hoisted vnode subtrees not getting hydrated causes HMR to fail

avatar
tjk
Sep 10th 2021

Version

3.2.11

Reproduction link

github.com

Steps to reproduce

See linked README

What is expected?

Should not error

What is actually happening?

Errors

avatar
tjk
Sep 10th 2021

If I disable the server render, the patching works fine. Otherwise, the vnodes under thead have null el.

avatar
tjk
Sep 12th 2021

So it seems like patchElement fails because vnode.el is null because hydrateElement stops recursing at table because it is hoisted (so children vnodes do not get el associated). Not sure what the problem is yet but just documenting my findings.

Since the table vnode is hoisted, the patchFlag is -1 which means children do not get hydrated. I'm guessing the table is incorrectly being hoisted?

Maybe the hoisting makes sense... but why does it not hydrate under hoisted? at the very least the elements should be hooked up even if things are static under there?

avatar
tjk
Sep 17th 2021

If someone can tell me which part of my code exploration above sounds like the problem (if any), I can attempt a patch.

Also, while I noticed a problem during HMR I imagine this could cause other problems too perhaps?