From f5f2215348858723224857d3f1cd8187cf5de8c6 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 13 Nov 2024 21:22:13 -0800 Subject: [PATCH] enh: sort functions list by type --- src/lib/components/workspace/Functions.svelte | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib/components/workspace/Functions.svelte b/src/lib/components/workspace/Functions.svelte index 24000d167..08e1e28a1 100644 --- a/src/lib/components/workspace/Functions.svelte +++ b/src/lib/components/workspace/Functions.svelte @@ -50,12 +50,14 @@ let showDeleteConfirm = false; let filteredItems = []; - $: filteredItems = $functions.filter( - (f) => - query === '' || - f.name.toLowerCase().includes(query.toLowerCase()) || - f.id.toLowerCase().includes(query.toLowerCase()) - ); + $: filteredItems = $functions + .filter( + (f) => + query === '' || + f.name.toLowerCase().includes(query.toLowerCase()) || + f.id.toLowerCase().includes(query.toLowerCase()) + ) + .sort((a, b) => a.type.localeCompare(b.type) || a.name.localeCompare(b.name)); const shareHandler = async (func) => { const item = await getFunctionById(localStorage.token, func.id).catch((error) => {