-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
feat(vapor): hydration #13226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: vapor
Are you sure you want to change the base?
feat(vapor): hydration #13226
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for vapor-repl ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-ssr
@vue/compiler-sfc
@vue/compiler-vapor
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/runtime-vapor
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
e704d07
to
58cd7db
Compare
16c91ca
to
287700c
Compare
9b7e68d
to
03bf24c
Compare
03bf24c
to
d8443d3
Compare
0cf3a63
to
86f0746
Compare
…p functions for node handling
86f0746
to
25b8fbe
Compare
b0852aa
to
3e7f093
Compare
e26120f
to
04eadd8
Compare
9f0a509
to
b5762b5
Compare
027b019
to
e9c9e49
Compare
e1f5482
to
eef8cb4
Compare
eef8cb4
to
e5399c3
Compare
09de814
to
9f7dced
Compare
9f7dced
to
4253b0c
Compare
f617294
to
18970f2
Compare
18970f2
to
ea34f2f
Compare
bfb692d
to
b8efc8b
Compare
b8efc8b
to
d776a26
Compare
Compiler Changes
@vue/compiler-ssr
):<!--if-->
,<!--for-->
,<!--slot-->
,<!--dynamic-component-->
,<!--[[-->
,<!--]]-->
) into the server-rendered HTML output. These anchors are essential markers for the client-side hydration process.@vue/compiler-vapor
):transformChildren
to create placeholder nodes (<!>
) in the template string for each dynamic child, facilitating node matching during hydration.Runtime Changes
Hydration-Aware APIs (
@vue/runtime-vapor
):createIf
,createFor
,createDynamicComponent
, andcreateSlot
are now hydration-aware. They use the SSR anchors (identified by labels likeIF_ANCHOR_LABEL
,FOR_ANCHOR_LABEL
, etc.) to locate and reuse corresponding DOM nodes rendered by the server.DOM Traversal (
@vue/runtime-vapor/dom
):Introduced hydration-specific implementations for DOM traversal helpers (
__child
,__next
,__nthChild
). These versions intelligently skip over SSR comment anchors and insignificant text nodes to correctly find the target nodes for hydration.Added
enableHydrationNodeLookup
anddisableHydrationNodeLookup
to switch between standard and hydration-specific traversal logic.see benchmark for
direct function call
vsdelegated function call
benchmark result
Core Runtime (
@vue/runtime-core
):hydration.ts
to recognize and correctly handle the hydration of Vapor components embedded within VDOM components.VDOM Interop (
@vue/runtime-vapor/vdomInterop.ts
):Shared Utilities (
@vue/shared
):domAnchors.ts
defining constants for the various anchor labels (e.g.,IF_ANCHOR_LABEL
,DYNAMIC_START_ANCHOR_LABEL
) and utility functions (isVaporAnchors
,isDynamicAnchor
,isVaporFragmentAnchor
) to identify these special comment nodes.Tests
runtime-vapor/__tests__/hydration.spec.ts
):v-if
,v-for
).slots
and dynamic components (<component :is="...">
).<!--[[-->
,<!--]]-->
).NOTE
The following two PR changes have already been included in this PR
next
,child
andnthChild
before setInsertionState #13057