fix(google-maps): detach overlay element on unmount#736
Conversation
Capture the anchor element at onAdd time so onRemove can detach it even after Vue has nulled the template ref during component unmount. Without this, toggling v-if=false leaves the reparented element in the Google Maps pane because overlayAnchor.value is already null when setMap(null) triggers onRemove. Resolves #735
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe component has been modified to store a reference to the overlay anchor element during the Google Maps Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
🔗 Linked issue
Resolves #735
❓ Type of change
📚 Description
<ScriptGoogleMapsOverlayView v-if="x">left its overlay element attached to the Google Maps pane after unmount, leaving a stale node visible on the map. The cause:onRemove()read the anchor throughuseTemplateRef, but Vue nulls template refs during component unmount beforeonUnmountedfires (and thus beforesetMap(null)triggersonRemove). The fix captures the element atonAddtime soonRemovecan detach it regardless of ref state. Includes a regression test undertest/nuxt-runtime/google-maps-overlay-view.nuxt.test.ts.