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

use React to unmount tooltip, not innerHTML #2

Closed
brambow opened this issue May 4, 2018 · 0 comments
Closed

use React to unmount tooltip, not innerHTML #2

brambow opened this issue May 4, 2018 · 0 comments

Comments

@brambow
Copy link

brambow commented May 4, 2018

Thanks so much for this example. I was using it with a style that only has a few layers, which only exist in the US (e.g. there isn't tile coverage for the whole world.):
image

When my cursor went outside those features I got the following error:

Warning: render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.

This isn't something you would encounter using a full OSM-based style, but to account for this I changed the setTooltip function to use ReactDOM.unmountComponentAtNode(this.tooltipContainer); instead of
this.tooltipContainer.innerHTML = ''; for removing the tooltip when there are no features.

bryik added a commit to bryik/mapbox-react-examples that referenced this issue Nov 3, 2019
Credit to @brambow for the solution.
mapbox#2
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

1 participant