Skip to content

Commit

Permalink
debugging reactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
razorness committed Feb 12, 2024
1 parent eebab59 commit b0db466
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 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": "3.1.1",
"version": "3.1.2-alpha.1",
"description": "Vue 3 plugin for maplibre-gl",
"keywords": [
"vue",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/sources/canvas.source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default /*#__PURE__*/ defineComponent({
if (v) {
source.value?.setCoordinates(v);
}
});
}, { immediate: true });

return () => [
createCommentVNode('Canvas Source'),
Expand Down
5 changes: 4 additions & 1 deletion src/lib/components/sources/geojson.source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export default /*#__PURE__*/ defineComponent({

useSource<GeoJSONSourceOptions>(source, props, 'geojson', sourceOpts, registry);

watch(() => props.data, v => source.value?.setData(v || { type: 'FeatureCollection', features: [] }));
watch(() => props.data, v => {
console.log('GEOJSON SOURCE', source, props.data);
source.value?.setData(v || { type: 'FeatureCollection', features: [] });
}, { immediate: true });

return () => [
createCommentVNode('GeoJSON Source'),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/sources/image.source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default /*#__PURE__*/ defineComponent({
if (v) {
source.value?.setCoordinates(v);
}
});
}, { immediate: true });

return () => [
createCommentVNode('Image Source'),
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/sources/vector.source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export default /*#__PURE__*/ defineComponent({

useSource<VectorSourceSpecification>(source, props, 'vector', sourceOpts, registry);

watch(() => props.tiles, v => source.value?.setTiles(v || []));
watch(() => props.url, v => source.value?.setUrl(v || ''));
watch(() => props.tiles, v => source.value?.setTiles(v || []), { immediate: true });
watch(() => props.url, v => source.value?.setUrl(v || ''), { immediate: true });

return () => [
createCommentVNode('Vector Source'),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/sources/video.source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default /*#__PURE__*/ defineComponent({
if (v) {
source.value?.setCoordinates(v);
}
});
}, { immediate: true });

return () => [
createCommentVNode('Video Source'),
Expand Down

0 comments on commit b0db466

Please sign in to comment.