Skip to content

Commit

Permalink
Merge pull request #246 from Arnei/fix-switch-page-issue
Browse files Browse the repository at this point in the history
Remove useAppDispatch from tableThunks.ts
  • Loading branch information
Arnei committed Jan 17, 2024
2 parents 99fe11b + 4c4e032 commit 7dfb62a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/src/thunks/tableThunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import { setGroupColumns } from "../actions/groupActions";
import { fetchAcls, setAclColumns } from "../slices/aclSlice";
import { setThemeColumns } from "../actions/themeActions";
import { setServicesColumns } from "../actions/serviceActions";
import { useAppDispatch } from "../store";

/**
* This file contains methods/thunks used to manage the table in the main view and its state changes
Expand Down Expand Up @@ -407,7 +406,6 @@ export const loadThemesIntoTable = () => (dispatch, getState) => {
// Navigate between pages
// @ts-expect-error TS(7006): Parameter 'pageNumber' implicitly has an 'any' typ... Remove this comment to see the full error message
export const goToPage = (pageNumber) => async (dispatch, getState) => {
const appDispatch = useAppDispatch();
dispatch(deselectAll());
dispatch(setOffset(pageNumber));

Expand Down Expand Up @@ -462,7 +460,7 @@ export const goToPage = (pageNumber) => async (dispatch, getState) => {
break;
}
case "acls": {
await appDispatch(fetchAcls());
await dispatch(fetchAcls());
dispatch(loadAclsIntoTable());
break;
}
Expand All @@ -477,7 +475,6 @@ export const goToPage = (pageNumber) => async (dispatch, getState) => {
// Update pages for example if page size was changed
// @ts-expect-error TS(7006): Parameter 'dispatch' implicitly has an 'any' type.
export const updatePages = () => async (dispatch, getState) => {
const appDispatch = useAppDispatch();
const state = getState();

const pagination = getTablePagination(state);
Expand Down Expand Up @@ -534,7 +531,7 @@ export const updatePages = () => async (dispatch, getState) => {
break;
}
case "acls": {
await appDispatch(fetchAcls());
await dispatch(fetchAcls());
dispatch(loadAclsIntoTable());
break;
}
Expand Down

0 comments on commit 7dfb62a

Please sign in to comment.