From 886f515926ae84731195caf0bf735757f0f40f3d Mon Sep 17 00:00:00 2001 From: Jim Grady Date: Mon, 23 Oct 2023 10:20:33 -0400 Subject: [PATCH] Clear mergeWords array sooner --- src/goals/MergeDuplicates/Redux/MergeDupsActions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/goals/MergeDuplicates/Redux/MergeDupsActions.ts b/src/goals/MergeDuplicates/Redux/MergeDupsActions.ts index 2be3bd9816..840658e3b3 100644 --- a/src/goals/MergeDuplicates/Redux/MergeDupsActions.ts +++ b/src/goals/MergeDuplicates/Redux/MergeDupsActions.ts @@ -114,7 +114,8 @@ export function mergeAll() { // Merge words. dispatch(getMergeWords()); - const mergeWordsArray = getState().mergeDuplicateGoal.mergeWords; + const mergeWordsArray = [...getState().mergeDuplicateGoal.mergeWords]; + dispatch(clearMergeWords()); if (mergeWordsArray.length) { const parentIds = await backend.mergeWords(mergeWordsArray); const childIds = [ @@ -125,7 +126,6 @@ export function mergeAll() { const completedMerge = { childIds, parentIds }; dispatch(addCompletedMergeToGoal(completedMerge)); await dispatch(asyncUpdateGoal()); - dispatch(clearMergeWords()); } }; }