From cd0ff8e234478698eb2bd34b80757d3a62664946 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 14 Jun 2024 12:29:29 +0000 Subject: [PATCH] fix: wait until any previous filter is in saving state --- packages/nc-gui/composables/useViewFilters.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/composables/useViewFilters.ts b/packages/nc-gui/composables/useViewFilters.ts index 5b834476d8..0326f8bb85 100644 --- a/packages/nc-gui/composables/useViewFilters.ts +++ b/packages/nc-gui/composables/useViewFilters.ts @@ -349,9 +349,12 @@ export function useViewFilters( // if already in progress the debounced function which will call this function again with 500ms delay until it's not saving if (savingStatus[i]) { return saveOrUpdateDebounced(filter, i, force, undo, skipDataReload) - } else { - savingStatus[i] = true } + // wait if any previous filter save is in progress, it's to avoid messing up the order of filters + else if (Array.from({ length: i }).some((_, index) => savingStatus[index])) { + return saveOrUpdateDebounced(filter, i, force, undo, skipDataReload) + } + savingStatus[i] = true if (!view.value && !linkColId?.value) return