From 5e538a5fe9e10b6b207c066f5a6b12435aa0be5e Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Fri, 24 Nov 2023 18:27:09 -0300 Subject: [PATCH] Allow `availableIceIps` variable to be undefined when it was not yet explicitly set This allows one to track when it is was already populated, and react to that. --- src/components/widgets/VideoPlayer.vue | 2 +- src/stores/video.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/widgets/VideoPlayer.vue b/src/components/widgets/VideoPlayer.vue index 89771dd14..b8539f29f 100644 --- a/src/components/widgets/VideoPlayer.vue +++ b/src/components/widgets/VideoPlayer.vue @@ -150,7 +150,7 @@ watch(selectedICEIPsField, () => { }) setInterval(() => { - const combinedIps = [...videoStore.availableIceIps, ...availableICEIPs.value] + const combinedIps = [...(videoStore.availableIceIps ?? []), ...availableICEIPs.value] const uniqueIps = combinedIps.filter((value, index, array) => array.indexOf(value) === index) videoStore.availableIceIps = uniqueIps }, 1000) diff --git a/src/stores/video.ts b/src/stores/video.ts index 0d534fd93..9184eece2 100644 --- a/src/stores/video.ts +++ b/src/stores/video.ts @@ -3,10 +3,10 @@ import { saveAs } from 'file-saver' import localforage from 'localforage' import { defineStore } from 'pinia' import Swal from 'sweetalert2' -import { reactive } from 'vue' +import { ref } from 'vue' export const useVideoStore = defineStore('video', () => { - const availableIceIps = reactive([]) + const availableIceIps = ref(undefined) const allowedIceIps = useStorage('cockpit-allowed-stream-ips', []) // Offer download of backuped videos