Skip to content

Commit ccf26d2

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 c3c57d5 commit ccf26d2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/components/shared/Stats.tsx

Lines changed: 7 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,8 +40,14 @@ const Stats = () => {
3940
}
4041
let filter = filterMap.find(({ name }) => name === f.name);
4142
filterValue = f.value;
43+
<<<<<<< HEAD
4244
if (!!filter) {
4345
dispatch(editFilterValue({filterName: filter.name, value: filterValue, resource: "events"}));
46+
======= // go to first page without reloading all events
47+
dispatch(setOffset(0));
48+
dispatch(setPageActive(0));
49+
dispatch(editFilterValue({ filterName: filter.name, value: filterValue, resource: "events" }));
50+
>>>>>>> be73635d4b (Go to first page when changing filters via Stats)
4451
}
4552
});
4653
await dispatch(fetchEvents());

0 commit comments

Comments
 (0)