From ad46fa1f6ccee6eb5bce3fae5a45b52180952d8f Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 11 Apr 2023 16:09:33 +0200 Subject: [PATCH] fix: displayNames --- .../collection-[collection]/settings/displayName.svelte | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/displayName.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/displayName.svelte index d10455874..3134b0cba 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/displayName.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/displayName.svelte @@ -7,19 +7,14 @@ import { last, symmetricDifference } from '$lib/helpers/array'; import { addNotification } from '$lib/stores/notifications'; import type { Models } from '@appwrite.io/console'; - import { onMount } from 'svelte'; import { attributes } from '../store'; import { preferences } from '$lib/stores/preferences'; import { page } from '$app/stores'; const collectionId = $page.params.collection; - let names: string[] = []; + let names: string[] = [...(preferences.getDisplayNames()?.[collectionId] ?? [])]; let search: string; - onMount(async () => { - names = [...(preferences.getDisplayNames()?.[collectionId] ?? [])]; - }); - async function updateDisplayName() { try { await preferences.setDisplayNames(collectionId, names); @@ -58,7 +53,7 @@ $: updateBtnDisabled = !symmetricDifference(names, preferences.getDisplayNames()?.[collectionId] ?? [])?.length || - !last(names); + (names?.length && !last(names));