Skip to content

Commit be73635

Browse files
committed
Go to first page when changing filters via Stats
Set the offset and page number to 0 when changing filters via the Stats Bar without reloading all events.
1 parent a03ccab commit be73635

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/shared/Stats.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
removeTextFilter,
1111
} from "../../slices/tableFilterSlice";
1212
import { loadEventsIntoTable } from "../../thunks/tableThunks";
13+
import { setOffset, setPageActive } from "../../slices/tableSlice"
1314
import { useAppDispatch, useAppSelector } from "../../store";
1415
import { fetchEvents } from "../../slices/eventSlice";
1516
import { ParseKeys } from "i18next";
@@ -39,6 +40,9 @@ const Stats = () => {
3940
const filter = filterMap.find(({ name }) => name === f.name);
4041
filterValue = f.value;
4142
if (filter) {
43+
// go to first page without reloading all events
44+
dispatch(setOffset(0));
45+
dispatch(setPageActive(0));
4246
dispatch(editFilterValue({ filterName: filter.name, value: filterValue, resource: "events" }));
4347
}
4448
});

0 commit comments

Comments
 (0)