From d21e25f72dbaaed2ebeac80257a45b6916560419 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Dec 2024 11:02:40 +0100 Subject: [PATCH] Fix nullish types --- .../src/components/grid/stores/datasources/nonPlus.ts | 2 +- .../src/components/grid/stores/datasources/table.ts | 2 +- .../src/components/grid/stores/datasources/viewV2.ts | 2 +- packages/frontend-core/src/components/grid/stores/filter.ts | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/frontend-core/src/components/grid/stores/datasources/nonPlus.ts b/packages/frontend-core/src/components/grid/stores/datasources/nonPlus.ts index 15bbc9b396..ae8f187278 100644 --- a/packages/frontend-core/src/components/grid/stores/datasources/nonPlus.ts +++ b/packages/frontend-core/src/components/grid/stores/datasources/nonPlus.ts @@ -91,7 +91,7 @@ export const initialise = (context: StoreContext) => { } // Wipe state - filter.set(get(initialFilter)) + filter.set(get(initialFilter) ?? undefined) inlineFilters.set([]) sort.set({ column: get(initialSortColumn), diff --git a/packages/frontend-core/src/components/grid/stores/datasources/table.ts b/packages/frontend-core/src/components/grid/stores/datasources/table.ts index 65d68a7d5d..e52faef5cc 100644 --- a/packages/frontend-core/src/components/grid/stores/datasources/table.ts +++ b/packages/frontend-core/src/components/grid/stores/datasources/table.ts @@ -108,7 +108,7 @@ export const initialise = (context: StoreContext) => { } // Wipe state - filter.set(get(initialFilter)) + filter.set(get(initialFilter) ?? undefined) inlineFilters.set([]) sort.set({ column: get(initialSortColumn), diff --git a/packages/frontend-core/src/components/grid/stores/datasources/viewV2.ts b/packages/frontend-core/src/components/grid/stores/datasources/viewV2.ts index e18b9f71c0..71c22e6866 100644 --- a/packages/frontend-core/src/components/grid/stores/datasources/viewV2.ts +++ b/packages/frontend-core/src/components/grid/stores/datasources/viewV2.ts @@ -121,7 +121,7 @@ export const initialise = (context: StoreContext) => { } // Reset state for new view - filter.set(get(initialFilter)) + filter.set(get(initialFilter) ?? undefined) inlineFilters.set([]) sort.set({ column: get(initialSortColumn), diff --git a/packages/frontend-core/src/components/grid/stores/filter.ts b/packages/frontend-core/src/components/grid/stores/filter.ts index 36f6cd9483..459b5ca652 100644 --- a/packages/frontend-core/src/components/grid/stores/filter.ts +++ b/packages/frontend-core/src/components/grid/stores/filter.ts @@ -120,5 +120,7 @@ export const initialise = (context: StoreContext) => { const { filter, initialFilter } = context // Reset filter when initial filter prop changes - initialFilter.subscribe(filter.set) + initialFilter.subscribe($initialFilter => + filter.set($initialFilter ?? undefined) + ) }