Skip to content

Commit b39d0c6

Browse files
committed
fix: update falsy values "0", "false" and "null"
only check if value are undefined.
1 parent 56b386d commit b39d0c6

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Diff for: src/components/layers/OlLayerGroup.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<script setup lang="ts">
88
import {
99
inject,
10-
provide,
11-
onUnmounted,
1210
onMounted,
13-
watch,
11+
onUnmounted,
12+
provide,
1413
shallowRef,
14+
watch,
1515
} from "vue";
1616
import LayerGroup, { type Options } from "ol/layer/Group";
1717
import type Map from "ol/Map";
@@ -58,7 +58,7 @@ watch(
5858
(newValue) => {
5959
for (const key in newValue) {
6060
const keyInObj = key as keyof typeof newValue;
61-
if (newValue[keyInObj]) {
61+
if (newValue[keyInObj] !== undefined) {
6262
layerGroup.value.set(key, newValue[keyInObj]);
6363
}
6464
}

Diff for: src/components/map/OlOverlay.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import type { PanIntoViewOptions, Positioning } from "ol/Overlay";
99
import Overlay, { type Options } from "ol/Overlay";
1010
import {
1111
inject,
12-
ref,
13-
watchEffect,
14-
watch,
1512
onMounted,
1613
onUnmounted,
14+
ref,
1715
shallowRef,
16+
watch,
17+
watchEffect,
1818
} from "vue";
1919
2020
import type Map from "ol/Map";
@@ -82,7 +82,7 @@ watch(
8282
(newValue) => {
8383
for (const key in newValue) {
8484
const keyInObj = key as keyof typeof newValue;
85-
if (newValue[keyInObj]) {
85+
if (newValue[keyInObj] !== undefined) {
8686
overlay.value.set(key, newValue[keyInObj]);
8787
}
8888
}

Diff for: src/composables/useLayer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { inject, onUnmounted, ref, watch, type Ref } from "vue";
1+
import { inject, onUnmounted, ref, type Ref, watch } from "vue";
22

33
import type { Map } from "ol";
44
import type LayerGroup from "ol/layer/Group";
@@ -26,7 +26,7 @@ export default function useLayerInMapOrLayerGroup(
2626

2727
for (const key in properties) {
2828
const keyInObj = key as keyof typeof properties;
29-
if (properties[keyInObj]) {
29+
if (properties[keyInObj] !== undefined) {
3030
layer.value.set(key, properties[keyInObj]);
3131
}
3232
}

0 commit comments

Comments
 (0)