Repository navigation
fix(KeepAlive): unmount pruned current component when its vnode was cloned on mount - #15711
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. π βΉοΈ Recent review infoβοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: π Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. π WalkthroughWalkthroughWhen ChangesKeepAlive pruning
Priority: β Normal Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Β· Severity of issue fixed: Medium Merge Risk: βͺ Minimal Β· up to The change addresses the reported unmount behavior, with no actionable merge risk identified beyond normal checks. Security Architecture ReviewSecurity architecture risk: π΅ Low Β· up to The change is confined to component cache teardown and corrects how a reused component is unmounted. No new access path or external dependency is evident, but validation of unusual scheduling cases is limited. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
π₯ Pre-merge checks | β 4 | β 1β Failed checks (1 warning)
β Passed checks (4 passed)
β¨ Finishing Touchesπ§ͺ Generate unit tests (beta)
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/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
Size ReportBundles
Usages
|
|
/ecosystem-ci run |
|
π Ran ecosystem CI: Open
|
close #15710
When KeepAlive re-renders and the child is found in the cache, the returned vnode gets
elfrom the cached one, sonormalizeVNode(cloneIfMounted) inrenderComponentRootclones it. That clone is what gets mounted and cached, socurrentand the cached vnode end up being different objects. Whenmaxthen prunes the entry of the component on screen,pruneCacheEntryonly resets the flag oncurrent. The mounted vnode keepsCOMPONENT_SHOULD_KEEP_ALIVE, so it gets deactivated instead of unmounted.The fix resets the flag on the cached vnode as well. Returning the already-mounted parent vnode, as in the issue, is one way to hit this; changing a prop on the child before switching views does it too.
Summary by CodeRabbit
KeepAlivecaching issue where a previously mounted component could be unmounted incorrectly when switching components with a cache limit of one.