vue-mapbox-gl
vue-mapbox-gl copied to clipboard
[Bugfix] Fix MapBox removal error and improve cleanup
https://github.com/studiometa/vue-mapbox-gl/issues/249
Fix MapBox removal error and improve cleanup
Issue
When navigating between pages, the following error occurs:
TypeError: Cannot read properties of null (reading 'removeChild')
This is related to a timing issue during map cleanup that has been present since MapBox GL 2.6.0.
What's Changed
- Fixed map removal error by:
- Adding proper cleanup sequence in
onUnmounted - Using
nextTickto ensure DOM is in correct state before removal - Adding null checks for map instance
- Adding proper cleanup sequence in
- Improved ResizeObserver cleanup to prevent memory leaks
- Enhanced TypeScript typings for better type safety
Technical Details
- Store ResizeObserver reference on map instance for reliable cleanup
- Added proper checks before map removal operations
- Implemented safer unmounting sequence using Vue's
nextTick - Added
MapWithResizeObserverinterface for type safety
Deploy request for vue-mapbox-gl pending review.
Visit the deploys page to approve it
| Name | Link |
|---|---|
| Latest commit | a69ad6cba38008f277469b39203948a42c602f0d |
Deploy Preview for vue-mapbox-gl-demo ready!
| Name | Link |
|---|---|
| Latest commit | a69ad6cba38008f277469b39203948a42c602f0d |
| Latest deploy log | https://app.netlify.com/sites/vue-mapbox-gl-demo/deploys/67a50c6971e163000883c1ce |
| Deploy Preview | https://deploy-preview-254--vue-mapbox-gl-demo.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
#249 has been fixed by #259, the other changes should be made in another PR.