fix(runtime-vapor): v-show on a Vapor child dropped on a root change, lost after a non-element root - #15566
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 ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/compiler-vapor
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/runtime-vapor
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
Size ReportBundles
Usages
|
|
I see the interop paths are being reworked right now (#15567, #15568) — let me know if this collides with anything in flight and I'll rebase out of your way. For what it's worth, this one deliberately stays on the existing path: it doesn't restructure the interop, it only makes the child's effective root be followed the way vdom already follows a component's inherited directives. If a smaller diff is easier to take, I'm happy to split it — the missing |
|
@ValentinYoushkevich If the overall approach looks good, I’ll either merge it as-is or make some adjustments first. If I come up with a better implementation, I’ll open a separate PR. |
… lost after a non-element root
f80f6de to
ee37a54
Compare
|
Rebased onto |
A VDOM directive on a Vapor child never sees the child's own re-render — no
beforeUpdate, noupdated— and when the child swaps its root element the directive does not follow it, so a child withv-show="false"paints visible. Once the root stops being an element the bindings are gone for good.https://play.vuejs.org/#eNrtlU1v2zAMhv8K4R3cAom9LxRd5njr1gHtYbu0GzAgwKpYbK3VkQRJcRIE+e+j5I85wZAVO++UkKYfUi8pehtdaJ3US4wmUWYLI7QDi26p85kUC62Mgy1YpwzCDu6NWkCcpMFOftq4j/nG6OdjKSreB/12efwglKvFQWTnaQOztCmESiDD4UJXzCFZAJnOPyhXQuHDDUp4QAdZoTjm9diWajWdRfessjiLsjS4myyuFBZqygOa0WtuBFZ5HsDc4+ZqjRYWS0uHd2wDlNJtYFVS2hoNbNQStEFrkyzVTR3zpXNKwvuiEsUjJW0kMUo5mMLQmE4h5qKO4R3EOoZJY82i3K6YproQQhxWuKC6srQBPyFJ7HDtPIgbRSAFDLwn4EYeLCGkmLPicR+r89r3phGxPxGVBUXFrKVEpAeBs0FXD9WFNM9SeqUnem3/Dux7f4SXpYOWk2ndpvJ/E4LA1qPnynA0E3ih19THSnB4dn5+/tY/Wgg5LlE8lG4CL8/0Ojg141zIhwm8Do5dGLGWGo2i/Uk9vAgQxHridTg2ul6PeizuDxrZDQjpc3t1fQOfv97cws3txXe4ur68/PQFTvyLPvZ0qDihkJT7M08foemO1bapK7IF5lJ1wxgCJ80NsYLTDWlGjWaWC4OFEzVCiQZHwCzgWpML+V779gwv9fCq/+PK+a/xcY07qUjeXk6DrEF1ijabdibTFJSsNiFhv1QpmsOdr+zOL0raLO0mCkuQHo8pim4gFcSKdhkTJtCEs6BWEpjkIMP2HITTt2Ym6RC+qELJsG59n6d9gSfbVpFmae5Ow5F+EMcKJelIr5Kz5PnYFMmbaPcL+0RMYg==
VDOM inherits a component's directives onto the rendered root vnode, so they follow that root through every patch and every replacement. I made the interop follow the child's effective root the same way, releasing the old element while it is still in the document and mounting onto the one that replaced it.
Two divergences stay:
createdandbeforeMountrun after insertion here, so av-showroot swap still flashes for one frame, and thebeforeUpdatethat already fires on a root about to be replaced remains — a Vapor root is only known once the child has rendered.