Skip to content

Commit

Permalink
fixes layer and source deconstruction
Browse files Browse the repository at this point in the history
  • Loading branch information
razorness committed Sep 15, 2021
1 parent 8bdce94 commit 2a5ef2e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-maplibre-gl",
"version": "1.0.0-beta.22",
"version": "1.0.0-beta.23",
"description": "Vue 3 plugin for maplibre-gl",
"keywords": [
"vue",
Expand Down
6 changes: 5 additions & 1 deletion src/components/layers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ export function handleDispose(isLoaded: Ref<boolean>, map: Ref<Map>, ci: Compone
function removeLayer() {
if (isLoaded.value) {
unregisterLayerEvents(map.value, props.layerId, ci.vnode);
map.value.removeLayer(props.layerId);
try {
map.value.removeLayer(props.layerId);
} catch (e) {
// silently fail
}
}
}

Expand Down
1 change: 0 additions & 1 deletion src/components/sources/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export function bindSource<T extends object, O extends object>(map: Ref<GlMap>,
emitter.on('styleSwitched', resetSource);

return onBeforeUnmount(() => {
console.log('UMOUNT SOURC')
if (isLoaded.value) {
registry.unmount();
map.value.removeSource(props.sourceId);
Expand Down

0 comments on commit 2a5ef2e

Please sign in to comment.