Skip to content

Commit

Permalink
fix infinite powerbi filters loading (#599)
Browse files Browse the repository at this point in the history
* fix infinite powerbi filters loading

* Prettified Code!

* ready to test

---------

Co-authored-by: Gustav-Eikaas <Gustav-Eikaas@users.noreply.github.com>
  • Loading branch information
Gustav-Eikaas and Gustav-Eikaas authored Apr 25, 2024
1 parent 0628564 commit f29cb2a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/power-bi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@equinor/workspace-powerbi",
"version": "2.0.1",
"version": "2.0.2",
"type": "module",
"sideEffects": false,
"license": "MIT",
Expand Down
4 changes: 3 additions & 1 deletion packages/power-bi/src/lib/components/Filter/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ type PowerBIFilterProps = {
export const PowerBIFilter = ({ report, options }: PowerBIFilterProps): JSX.Element | null => {
const [activeFilters, setActiveFilters] = useState<Record<string, ActiveFilter[]>>({});
const [slicerFilters, setSlicerFilters] = useState<PowerBiFilter[] | null>(null);
const [isFiltersLoading, setisFiltersLoading] = useState(true);
const [filterGroupVisible, setFilterGroupVisible] = useVisibleFilters(report, options);

const [isFilterExpanded, setIsFilterExpanded] = useState(false);
Expand Down Expand Up @@ -172,6 +173,7 @@ export const PowerBIFilter = ({ report, options }: PowerBIFilterProps): JSX.Elem
} else {
setFilterGroupVisible(filters.map((s) => s.type));
}
setisFiltersLoading(false);
};

initFilters();
Expand Down Expand Up @@ -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 <QuickFilterLoading />;
if (isFiltersLoading || !activeFilters || !slicerFilters) return <QuickFilterLoading />;

const controller: FilterController = {
handleChangeGroup,
Expand Down
2 changes: 1 addition & 1 deletion packages/workspace-fusion/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@equinor/workspace-fusion",
"version": "8.0.2",
"version": "8.0.3",
"type": "module",
"sideEffects": false,
"license": "MIT",
Expand Down

0 comments on commit f29cb2a

Please sign in to comment.