From 9ef5107ce504fe426a952caaae2fd1e654bcbf5b Mon Sep 17 00:00:00 2001 From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> Date: Thu, 28 Apr 2022 14:14:48 +0600 Subject: [PATCH] Minor table loading fix (#1580) Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> --- plugins/view-resources/src/components/Table.svelte | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/view-resources/src/components/Table.svelte b/plugins/view-resources/src/components/Table.svelte index 93a07eaed9..c1bb00bc9f 100644 --- a/plugins/view-resources/src/components/Table.svelte +++ b/plugins/view-resources/src/components/Table.svelte @@ -42,7 +42,7 @@ let sortKey = 'modifiedOn' let sortOrder = SortingOrder.Descending - let loading = false + let loading = 0 let objects: Doc[] = [] const refs: HTMLElement[] = [] @@ -73,13 +73,12 @@ objects.sort((a, b) => -1 * sortOrder * sf(a, b)) } dispatch('content', objects) - loading = false + loading-- }, { sort: { [sortKey]: sortOrder }, limit: 200, ...options } ) - if (update) { + if (update && ++loading > 0) { objects = [] - loading = true } } $: update(_class, query, sortKey, sortOrder, options) @@ -290,6 +289,6 @@ {/await} -{#if loading} +{#if loading > 0} {/if}