Loading client/src/components/Form/Elements/FormSelect.vue +1 −7 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faCheckSquare, faSquare } from "@fortawesome/free-regular-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { toValue } from "@vueuse/core"; import { computed, type ComputedRef, onMounted, type PropType, ref, watch } from "vue"; import Multiselect from "vue-multiselect"; Loading Loading @@ -57,7 +56,7 @@ const emit = defineEmits<{ }>(); const filter = ref(""); const filteredOptions = filterByLabelAndTag(); const filteredOptions = useFilterObjectArray(() => props.options, filter, ["label", ["value", "tags"]]); /** * When there are more options than this, push selected options to the end Loading Loading @@ -149,7 +148,6 @@ function setInitialValue(): void { watch( () => props.options, () => { filteredOptions.value = toValue(filterByLabelAndTag()); setInitialValue(); } ); Loading @@ -161,10 +159,6 @@ onMounted(() => { setInitialValue(); }); function filterByLabelAndTag() { return useFilterObjectArray(() => props.options, filter, ["label", ["value", "tags"]]); } function isValueWithTags(item: SelectValue): item is ValueWithTags { return item !== null && typeof item === "object" && (item as ValueWithTags).tags !== undefined; } Loading client/src/composables/__mocks__/filter.ts +2 −2 Original line number Diff line number Diff line import { toValue } from "@vueuse/core"; import { Ref, ref } from "vue"; import { computed, Ref } from "vue"; import type { useFilterObjectArray as UseFilterObjectArray } from "@/composables/filter"; Loading @@ -9,5 +9,5 @@ jest.mock("@/composables/filter", () => ({ export const useFilterObjectArray: typeof UseFilterObjectArray = (array): Ref<any[]> => { console.debug("USING MOCKED useFilterObjectArray"); return ref(toValue(array)); return computed(() => toValue(array)); }; Loading
client/src/components/Form/Elements/FormSelect.vue +1 −7 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faCheckSquare, faSquare } from "@fortawesome/free-regular-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { toValue } from "@vueuse/core"; import { computed, type ComputedRef, onMounted, type PropType, ref, watch } from "vue"; import Multiselect from "vue-multiselect"; Loading Loading @@ -57,7 +56,7 @@ const emit = defineEmits<{ }>(); const filter = ref(""); const filteredOptions = filterByLabelAndTag(); const filteredOptions = useFilterObjectArray(() => props.options, filter, ["label", ["value", "tags"]]); /** * When there are more options than this, push selected options to the end Loading Loading @@ -149,7 +148,6 @@ function setInitialValue(): void { watch( () => props.options, () => { filteredOptions.value = toValue(filterByLabelAndTag()); setInitialValue(); } ); Loading @@ -161,10 +159,6 @@ onMounted(() => { setInitialValue(); }); function filterByLabelAndTag() { return useFilterObjectArray(() => props.options, filter, ["label", ["value", "tags"]]); } function isValueWithTags(item: SelectValue): item is ValueWithTags { return item !== null && typeof item === "object" && (item as ValueWithTags).tags !== undefined; } Loading
client/src/composables/__mocks__/filter.ts +2 −2 Original line number Diff line number Diff line import { toValue } from "@vueuse/core"; import { Ref, ref } from "vue"; import { computed, Ref } from "vue"; import type { useFilterObjectArray as UseFilterObjectArray } from "@/composables/filter"; Loading @@ -9,5 +9,5 @@ jest.mock("@/composables/filter", () => ({ export const useFilterObjectArray: typeof UseFilterObjectArray = (array): Ref<any[]> => { console.debug("USING MOCKED useFilterObjectArray"); return ref(toValue(array)); return computed(() => toValue(array)); };