diff --git a/packages/filter/package.json b/packages/filter/package.json index 0d1bdee1d..8e8439cbf 100644 --- a/packages/filter/package.json +++ b/packages/filter/package.json @@ -1,6 +1,6 @@ { "name": "@equinor/workspace-filter", - "version": "3.0.0", + "version": "3.0.1", "type": "module", "sideEffects": false, "license": "MIT", diff --git a/packages/filter/src/lib/components/quickFilter/QuickFilter.tsx b/packages/filter/src/lib/components/quickFilter/QuickFilter.tsx index e520e2556..c029a0bc7 100644 --- a/packages/filter/src/lib/components/quickFilter/QuickFilter.tsx +++ b/packages/filter/src/lib/components/quickFilter/QuickFilter.tsx @@ -129,7 +129,10 @@ const QuickFilterReady = ({ groups }: QuickFilterReadyProps) => { {isFilterExpanded && ( - visibleFilterGroups.includes(s.name))} /> + groups.find((s) => s.name === x)).filter(Boolean) as IFilterGroup[]} + /> )} ); diff --git a/packages/filter/src/lib/components/toggleHideFilterPopover/ToggleHideFilterPopover.tsx b/packages/filter/src/lib/components/toggleHideFilterPopover/ToggleHideFilterPopover.tsx index 653aa8781..63bee76d7 100644 --- a/packages/filter/src/lib/components/toggleHideFilterPopover/ToggleHideFilterPopover.tsx +++ b/packages/filter/src/lib/components/toggleHideFilterPopover/ToggleHideFilterPopover.tsx @@ -2,7 +2,6 @@ import { Icon, Checkbox, Popover } from '@equinor/eds-core-react'; import { tokens } from '@equinor/eds-tokens'; import { useState, useRef } from 'react'; import { ReactSortable } from 'react-sortablejs'; -import { SortObject } from '../../types/sortObject'; import { StyledButton, StyledItemWrapper, StyledPopoverList } from './toggleHideFilterPopover.styles'; interface ShowHideFilterButtonProps { @@ -19,18 +18,19 @@ export const ToggleHideFilterPopover = ({ const [isOpen, setIsOpen] = useState(false); const ref = useRef(null); - const [list, setList] = useState[]>(allFilters.map((s) => ({ id: s, item: s }))); + const listRef = useRef(allFilters.map((s) => ({ id: s, item: s }))); const handleChange = (val: string) => { if (visibleFilters.includes(val)) { - setVisibleFilters(visibleFilters.filter((s) => s !== val)); + setVisibleFilters([...visibleFilters.filter((s) => s !== val)]); } else { setVisibleFilters([...visibleFilters, val]); } }; const DraggableHandleSelector = 'globalDraggableHandle'; - const updateList = () => setVisibleFilters(list.map((s) => s.item).filter((s) => visibleFilters.includes(s))); + const updateList = () => + setVisibleFilters(listRef.current.map((s) => s.item).filter((s) => visibleFilters.includes(s))); return ( <> @@ -51,11 +51,13 @@ export const ToggleHideFilterPopover = ({ { + listRef.current = e; + }} onEnd={updateList} > - {list.map(({ item }) => ( + {listRef.current.map(({ item }) => ( (props: WorkspaceContextProviderProps handleTabChange, updatePayload, isCreateSidesheetOpen, - openCreateSidesheet: () => setCreateSidesheetOpen(true), + openCreateSidesheet: () => { + clearSelection(); + setCreateSidesheetOpen(true); + }, closeCreateSidesheet: () => setCreateSidesheetOpen(false), clearSelection, selectById,