Skip to content

Commit e42ce1e

Browse files
committed
Merge branch 'stats-filter-first-page' of ciegler/opencast-admin-interface into r/17.x
Pull request #1477 Go to first page when changing filters via Stats
2 parents 472dad2 + 0fc18c2 commit e42ce1e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/shared/Stats.tsx

Lines changed: 5 additions & 1 deletion
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";
@@ -40,7 +41,10 @@ const Stats = () => {
4041
let filter = filterMap.find(({ name }) => name === f.name);
4142
filterValue = f.value;
4243
if (!!filter) {
43-
dispatch(editFilterValue({filterName: filter.name, value: filterValue, resource: "events"}));
44+
// go to first page without reloading all events
45+
dispatch(setOffset(0));
46+
dispatch(setPageActive(0));
47+
dispatch(editFilterValue({ filterName: filter.name, value: filterValue, resource: "events" }));
4448
}
4549
});
4650
await dispatch(fetchEvents());

0 commit comments

Comments
 (0)