Update packages, fix table page selector

This commit is contained in:
Jamie Curnow
2022-05-22 23:55:26 +10:00
parent e4a97d4813
commit db61a9a175
5 changed files with 1163 additions and 994 deletions

View File

@@ -23,6 +23,7 @@ const tableEvents = {
};
const tableEventReducer = (state: any, { type, payload }: any) => {
let offset = state.offset;
switch (type) {
case tableEvents.PAGE_CHANGED:
return {
@@ -45,9 +46,15 @@ const tableEventReducer = (state: any, { type, payload }: any) => {
sortBy: payload,
};
case tableEvents.FILTERS_CHANGED:
if (state.filters !== payload) {
// this actually was a legit change
// sets to page 1 when filter is modified
offset = 0;
}
return {
...state,
filters: payload,
offset,
};
default:
throw new Error(`Unhandled action type: ${type}`);