Azure / Azure/react-azure-maps
Uncaught error 'source-id' is already added to the map
- Dominant language
- TypeScript
- Stars
- 58
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Description
`Uncaught error 'source-id' is already added to the map`
I can trigger this error by toggling a rendered data source and layer. For example by toggling the value of showLayer off and on again:
```
const { showLayer } = props;
return (
{showLayer
?
: null
}
)
```
It looks like data source cleanup is not being done by react-azure-maps?
If I manually remove the source and layer in a cleanup useEffect:
```
useEffect(() => {
return () => {
map.layers.remove('layer'id');
map.sources.remove('source-id);
}
}, []);
```
It fixes the error, but then I get further errors from the wrapper as it tries to remove the layers itself:
`Error on remove layer Error: The layer 'layer-id' has not been added to the map and cannot be removed`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.