From 54c4dfbba71504e0914caffcd34cd62293b873f2 Mon Sep 17 00:00:00 2001 From: Benjamin Kane Date: Mon, 3 Jul 2023 13:09:41 -0600 Subject: [PATCH] update sidebar test, fix small regressions --- app/packages/state/src/recoil/sidebar.ts | 3 ++- app/packages/state/src/recoil/utils.ts | 7 +++++++ app/packages/state/tests/recoil/sidebar.test.ts | 6 +----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/packages/state/src/recoil/sidebar.ts b/app/packages/state/src/recoil/sidebar.ts index dee25517cf..5f13e1bb3a 100644 --- a/app/packages/state/src/recoil/sidebar.ts +++ b/app/packages/state/src/recoil/sidebar.ts @@ -170,7 +170,7 @@ const NONE = [null, undefined]; export const resolveGroups = ( sampleFields: StrictField[], frameFields: StrictField[], - sidebarGroups: State.SidebarGroup[], + sidebarGroups?: State.SidebarGroup[], current?: State.SidebarGroup[] ): State.SidebarGroup[] => { let groups = sidebarGroups @@ -262,6 +262,7 @@ const groupUpdater = ( const index = groupNames.indexOf(name); if (index < 0) { groups.push({ name, paths, expanded: false }); + groupNames.push(name); return; } diff --git a/app/packages/state/src/recoil/utils.ts b/app/packages/state/src/recoil/utils.ts index a8e885844f..10e510c169 100644 --- a/app/packages/state/src/recoil/utils.ts +++ b/app/packages/state/src/recoil/utils.ts @@ -126,6 +126,13 @@ export const unsupportedMatcher = (field: StrictField) => { return true; } + if ( + field.ftype === LIST_FIELD && + (UNSUPPORTED_FILTER_TYPES.includes(field.subfield) || !field.subfield) + ) { + return true; + } + if ( field.ftype === LIST_FIELD && field.subfield === EMBEDDED_DOCUMENT_FIELD && diff --git a/app/packages/state/tests/recoil/sidebar.test.ts b/app/packages/state/tests/recoil/sidebar.test.ts index 63b72072ce..ee906bdc7b 100644 --- a/app/packages/state/tests/recoil/sidebar.test.ts +++ b/app/packages/state/tests/recoil/sidebar.test.ts @@ -187,11 +187,7 @@ const mockFields = { describe("ResolveGroups works", () => { it("dataset groups should resolve when curent is undefined", () => { - const test = sidebar.resolveGroups( - mockFields.sampleFields, - mockFields.sampleFields, - [] - ); + const test = sidebar.resolveGroups(mockFields.sampleFields, []); expect(test.length).toBe(5); expect(test[0].name).toBe("tags");