Skip to content

Commit

Permalink
fix infinite powerbi filters loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustav-Eikaas committed Apr 3, 2024
1 parent 84f95a7 commit f170f06
Showing 1 changed file with 3 additions and 1 deletion.
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) return <QuickFilterLoading />;

const controller: FilterController = {
handleChangeGroup,
Expand Down

0 comments on commit f170f06

Please sign in to comment.