fix(vue-query-devtools): guard unmount with mounted flag to prevent SSR crash#10378
fix(vue-query-devtools): guard unmount with mounted flag to prevent SSR crash#10378mixelburg wants to merge 1 commit intoTanStack:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughBoth Vue devtools components now track mount state with a boolean flag, ensuring Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Fixes #10374
Problem
VueQueryDevtoolsandVueQueryDevtoolsPanelcalldevtools.unmount()inonScopeDispose. In SSR,@vue/server-renderercallscleanupContext()afterrenderToString()(introduced in vuejs/core#14548), which disposes the Vue scope beforeonMountedever fires —isMountedis stillfalseat that point andunmount()throwsError: Devtools is not mounted.Fix
Track mount state locally with a
mountedflag that is set totrueinsideonMounted. TheonScopeDisposecallback only callsunmount()when the devtools were actually mounted. No changes to theTanstackQueryDevtoolsclass itself.Applied to both
devtools.vueanddevtoolsPanel.vue.Summary by CodeRabbit