Skip to content

Commit

Permalink
Fix bug where onSuccess is called upon pagination change
Browse files Browse the repository at this point in the history
Because fetchLists changes when pagination does, and handleUploadSuccess
changes with fetchLists, our useEffect in Form was being fired on every
pagination change due to its onSuccess changing.

The solution in this instance is to remove fetchLists from
handleUploadSuccess's dependencies, as we merely want to invoke
fetchLists from it, not change our reference.
  • Loading branch information
rylnd committed Jul 3, 2020
1 parent 728b272 commit 0abbfc4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export const ValueListsModalComponent: React.FC<ValueListsModalProps> = ({
});
fetchLists();
},
[fetchLists, toasts]
// eslint-disable-next-line react-hooks/exhaustive-deps
[toasts]
);

useEffect(() => {
Expand Down

0 comments on commit 0abbfc4

Please sign in to comment.