From f29cb2a43edfd443b1b5d6ccedd2f8c8466d94c0 Mon Sep 17 00:00:00 2001 From: Gustav-Eikaas <89254170+Gustav-Eikaas@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:50:12 +0200 Subject: [PATCH] fix infinite powerbi filters loading (#599) * fix infinite powerbi filters loading * Prettified Code! * ready to test --------- Co-authored-by: Gustav-Eikaas --- packages/power-bi/package.json | 2 +- packages/power-bi/src/lib/components/Filter/Filter.tsx | 4 +++- packages/workspace-fusion/package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/power-bi/package.json b/packages/power-bi/package.json index dc5c00dad..8e8faded5 100644 --- a/packages/power-bi/package.json +++ b/packages/power-bi/package.json @@ -1,6 +1,6 @@ { "name": "@equinor/workspace-powerbi", - "version": "2.0.1", + "version": "2.0.2", "type": "module", "sideEffects": false, "license": "MIT", diff --git a/packages/power-bi/src/lib/components/Filter/Filter.tsx b/packages/power-bi/src/lib/components/Filter/Filter.tsx index be82adedd..96f9b7e8b 100644 --- a/packages/power-bi/src/lib/components/Filter/Filter.tsx +++ b/packages/power-bi/src/lib/components/Filter/Filter.tsx @@ -46,6 +46,7 @@ type PowerBIFilterProps = { export const PowerBIFilter = ({ report, options }: PowerBIFilterProps): JSX.Element | null => { const [activeFilters, setActiveFilters] = useState>({}); const [slicerFilters, setSlicerFilters] = useState(null); + const [isFiltersLoading, setisFiltersLoading] = useState(true); const [filterGroupVisible, setFilterGroupVisible] = useVisibleFilters(report, options); const [isFilterExpanded, setIsFilterExpanded] = useState(false); @@ -172,6 +173,7 @@ export const PowerBIFilter = ({ report, options }: PowerBIFilterProps): JSX.Elem } else { setFilterGroupVisible(filters.map((s) => s.type)); } + setisFiltersLoading(false); }; initFilters(); @@ -205,7 +207,7 @@ export const PowerBIFilter = ({ report, options }: PowerBIFilterProps): JSX.Elem } }, [activeFilters, Object.keys(activeFilters).length]); - if (!slicerFilters || Object.keys(activeFilters).length === 0) return ; + if (isFiltersLoading || !activeFilters || !slicerFilters) return ; const controller: FilterController = { handleChangeGroup, diff --git a/packages/workspace-fusion/package.json b/packages/workspace-fusion/package.json index 33f9f02be..de8dca87b 100644 --- a/packages/workspace-fusion/package.json +++ b/packages/workspace-fusion/package.json @@ -1,6 +1,6 @@ { "name": "@equinor/workspace-fusion", - "version": "8.0.2", + "version": "8.0.3", "type": "module", "sideEffects": false, "license": "MIT",