Skip to content

Commit

Permalink
fix: Double fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
amattu2 committed Jan 17, 2024
1 parent f0f0d49 commit d935ffa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/components/DataSubmissions/GenericTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export type FetchListing<T> = {

export type TableMethods = {
refresh: () => void;
setPage: (page: number) => void;
setPage: (page: number, forceRefetch?: boolean) => void;
};

type Props<T> = {
Expand Down Expand Up @@ -195,8 +195,11 @@ const GenericTable = <T,>({
refresh: () => {
fetchData(true);
},
setPage: (newPage: number) => {
setPage: (newPage: number, forceRefetch = false) => {
setPage(newPage);
if (forceRefetch) {
fetchData(true);
}
}
}));

Expand Down
3 changes: 1 addition & 2 deletions src/content/dataSubmissions/QualityControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ const QualityControl: FC = () => {
}), [handleOpenErrorDialog]);

useEffect(() => {
tableRef.current?.refresh();
tableRef.current?.setPage(0);
tableRef.current?.setPage(0, true);
}, [watch("nodeType"), watch("batchID"), watch("severity")]);

return (
Expand Down

0 comments on commit d935ffa

Please sign in to comment.