Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Fix MapBox removal error and improve cleanup #254

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

steklopod
Copy link

#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 nextTick to ensure DOM is in correct state before removal
    • Adding null checks for map instance
  • 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 MapWithResizeObserver interface for type safety

Copy link

netlify bot commented Feb 6, 2025

👷 Deploy request for vue-mapbox-gl pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit a69ad6c

Copy link

netlify bot commented Feb 6, 2025

Deploy Preview for vue-mapbox-gl-demo ready!

Name Link
🔨 Latest commit a69ad6c
🔍 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...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@titouanmathis
Copy link
Collaborator

titouanmathis commented Feb 12, 2025

#249 has been fixed by #259, the other changes should be made in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants