From ae6aa60cd18acdc9ad24bf3836ff0a92264a45f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20Engstr=C3=B6m?= Date: Tue, 17 Dec 2024 15:49:50 +0100 Subject: [PATCH] Derive lxlQualifier plugin --- lxl-web/src/lib/components/Search.svelte | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lxl-web/src/lib/components/Search.svelte b/lxl-web/src/lib/components/Search.svelte index 8f9e54b4e..0025832aa 100644 --- a/lxl-web/src/lib/components/Search.svelte +++ b/lxl-web/src/lib/components/Search.svelte @@ -72,10 +72,13 @@ return data; } - function getLabels(key: string, value?: string) { - let pageMapping = $page.data.searchResult?.mapping; - return getLabelFromMappings(key, value, pageMapping, suggestMapping); - } + let derivedLxlQualifierPlugin = $derived.by(() => { + function getLabels(key: string, value?: string) { + let pageMapping = $page.data.searchResult?.mapping; + return getLabelFromMappings(key, value, pageMapping, suggestMapping); + } + return lxlQualifierPlugin(getLabels); + });
@@ -93,7 +96,7 @@ })} transformFn={handleTransform} paginationQueryFn={handlePaginationQuery} - extensions={[lxlQualifierPlugin(getLabels)]} + extensions={[derivedLxlQualifierPlugin]} > {#snippet resultItem(item)}