From 0ef5c369005ede93dce78fc3105fc2d70b5ee7dd Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Sun, 18 Dec 2022 14:38:29 -0800 Subject: [PATCH] Fixes #1990 by only coming list when relative fields change (#1993) --- assets/pages/index.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/assets/pages/index.vue b/assets/pages/index.vue index b9f37dd7..a22f7798 100644 --- a/assets/pages/index.vue +++ b/assets/pages/index.vue @@ -78,7 +78,7 @@ import SearchIcon from "~icons/mdi-light/magnify"; import { useFuse } from "@vueuse/integrations/useFuse"; -const { base, version, secured } = config; +const { version } = config; const containerStore = useContainerStore(); const { containers } = storeToRefs(containerStore); const router = useRouter(); @@ -89,10 +89,22 @@ const query = ref(""); const mostRecentContainers = $computed(() => [...containers.value].sort((a, b) => b.created - a.created)); const runningContainers = $computed(() => mostRecentContainers.filter((c) => c.state === "running")); -const { results } = useFuse(query, containers, { +const list = computed(() => { + return containers.value.map(({ id, created, name, state }) => { + return { + id, + created, + name, + state, + }; + }); +}); + +const { results } = useFuse(query, list, { fuseOptions: { keys: ["name"] }, matchAllWhenSearchEmpty: false, }); + const data = computed(() => { if (results.value.length) { return results.value.map(({ item }) => item);