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

allow re-use of map instance on re-mount #176

Open
timonkuiters opened this issue Jun 11, 2024 · 2 comments
Open

allow re-use of map instance on re-mount #176

timonkuiters opened this issue Jun 11, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@timonkuiters
Copy link

If a map unmounts and mounts multiple times, it is re-initialised every time, which you can see visually. A reuseId prop could perhaps identify the map instance, so it could be saved when unmounted, and re-used when re-mounted.

@dimfeld
Copy link
Owner

dimfeld commented Jun 11, 2024

Assuming it works to keep the map active while detaching its anchor element from the DOM, there's still a lot of complexity involved here. Every component inside the map would have to reconcile with the existing state in the map as well as adding sources/layers that need to exist, and removing those which are left over from the previous instantiation.

I'm not totally opposed to such a feature but it's a big effort to actually get this working properly. I think it would probably work better to have some solution that can just hide the map component, instead of tearing it down.

@dimfeld dimfeld added the enhancement New feature or request label Jun 20, 2024
@dabreegster
Copy link
Contributor

Related to #184

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

No branches or pull requests

3 participants