Skip to content

Commit

Permalink
fix: clean up fetchdata
Browse files Browse the repository at this point in the history
  • Loading branch information
InsaneZein committed Dec 6, 2024
1 parent 6a8811c commit adde5ce
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/smart-components/role/RolesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ const RolesTable: React.FunctionComponent<RolesTableProps> = ({ selectedRole })
const { selected, onSelect, isSelected } = selection;

const fetchData = useCallback(
(apiProps: { count: number; limit: number; offset: number; orderBy: string; filters: RoleFilters }) => {
const { count, limit, offset, orderBy, filters } = apiProps;
dispatch(fetchRolesWithPolicies({ ...mappedProps({ count, limit, offset, orderBy, filters }) }));
(apiProps: { limit: number; offset: number; orderBy: string; filters: RoleFilters }) => {
const { limit, offset, orderBy, filters } = apiProps;
dispatch(fetchRolesWithPolicies({ ...mappedProps({ limit, offset, orderBy, filters }) }));
},
[dispatch]
);
Expand All @@ -95,7 +95,6 @@ const RolesTable: React.FunctionComponent<RolesTableProps> = ({ selectedRole })
limit: perPage,
offset: (page - 1) * perPage,
orderBy: `${direction === 'desc' ? '-' : ''}${sortBy}`,
count: totalCount || 0,
filters: filters,
});
}, [fetchData, page, perPage, sortBy, direction]);
Expand All @@ -107,12 +106,10 @@ const RolesTable: React.FunctionComponent<RolesTableProps> = ({ selectedRole })
limit: perPage,
offset: (page - 1) * perPage,
orderBy: `${direction === 'desc' ? '-' : ''}${sortBy}`,
count: totalCount || 0,
filters: filters,
}),
800
);
return () => {};
}, [debouncedFetch, filters, onSetFilters]);

const getSortParams = (columnIndex: number): ThProps['sort'] => ({
Expand Down

0 comments on commit adde5ce

Please sign in to comment.