fix: dashboard filter value is cleared when 2 similar dashboards opened in succession (#21461)
This commit is contained in:
parent
ae6d2cf18d
commit
59ca7861c0
|
|
@ -250,6 +250,7 @@ const FilterBar: React.FC<FiltersBarProps> = ({
|
|||
const dashboardId = useSelector<any, string>(
|
||||
({ dashboardInfo }) => dashboardInfo?.id,
|
||||
);
|
||||
const previousDashboardId = usePrevious(dashboardId);
|
||||
const canEdit = useSelector<RootState, boolean>(
|
||||
({ dashboardInfo }) => dashboardInfo.dash_edit_perm,
|
||||
);
|
||||
|
|
@ -283,7 +284,7 @@ const FilterBar: React.FC<FiltersBarProps> = ({
|
|||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (previousFilters) {
|
||||
if (previousFilters && dashboardId === previousDashboardId) {
|
||||
const updates = {};
|
||||
Object.values(filters).forEach(currentFilter => {
|
||||
const previousFilter = previousFilters?.[currentFilter.id];
|
||||
|
|
@ -310,7 +311,11 @@ const FilterBar: React.FC<FiltersBarProps> = ({
|
|||
Object.keys(updates).forEach(key => dispatch(clearDataMask(key)));
|
||||
}
|
||||
}
|
||||
}, [JSON.stringify(filters), JSON.stringify(previousFilters)]);
|
||||
}, [
|
||||
JSON.stringify(filters),
|
||||
JSON.stringify(previousFilters),
|
||||
previousDashboardId,
|
||||
]);
|
||||
|
||||
const dataMaskAppliedText = JSON.stringify(dataMaskApplied);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue