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

Map container is being reused by another instance #352

Open
neverlose-lv opened this issue Feb 27, 2023 · 2 comments
Open

Map container is being reused by another instance #352

neverlose-lv opened this issue Feb 27, 2023 · 2 comments

Comments

@neverlose-lv
Copy link

  ngOnDestroy(): void {
    if (this.map) {
      this.map.remove();
    }
  }

results me into an error:

Map container is being reused by another instance
@epazs
Copy link

epazs commented Mar 25, 2023

The same thing happens to me and I am not able to solve it

@vvandens
Copy link

vvandens commented Jul 5, 2023

Had the same issue...
The problem came from my own component ngOnDestroy calling remove() on the map instance. The directive does it already so it's no use and breaks the following test in the leaflet source, since after the 1st remove, this._containerId is undefined :

if (this._containerId !== this._container._leaflet_id) {
  throw new Error('Map container is being reused by another instance');
}

Just get rid of your own this.map.remove() in your ngOnDestroy.

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

No branches or pull requests

3 participants