From 0abbfc422a6356db70cacea2834f08d2cf214420 Mon Sep 17 00:00:00 2001 From: Ryland Herrick Date: Thu, 2 Jul 2020 22:15:38 -0500 Subject: [PATCH] Fix bug where onSuccess is called upon pagination change 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. --- .../alerts/components/value_lists_management_modal/modal.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/alerts/components/value_lists_management_modal/modal.tsx b/x-pack/plugins/security_solution/public/alerts/components/value_lists_management_modal/modal.tsx index f4678da9bf54d..eea13fae7a273 100644 --- a/x-pack/plugins/security_solution/public/alerts/components/value_lists_management_modal/modal.tsx +++ b/x-pack/plugins/security_solution/public/alerts/components/value_lists_management_modal/modal.tsx @@ -91,7 +91,8 @@ export const ValueListsModalComponent: React.FC = ({ }); fetchLists(); }, - [fetchLists, toasts] + // eslint-disable-next-line react-hooks/exhaustive-deps + [toasts] ); useEffect(() => {