From 81505eb87155e3c4263aa4e95fd8f5dcdd4b2bb2 Mon Sep 17 00:00:00 2001 From: Thomas Zemp Date: Tue, 10 Dec 2024 14:03:21 +0100 Subject: [PATCH] fix: set false on successive completion actions with compulsory deoperands --- src/bottom-bar/use-on-complete-callback.js | 2 +- .../completion/use-imperative-cancel-completion-mutation.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bottom-bar/use-on-complete-callback.js b/src/bottom-bar/use-on-complete-callback.js index 0cb4d8c29..16235204d 100644 --- a/src/bottom-bar/use-on-complete-callback.js +++ b/src/bottom-bar/use-on-complete-callback.js @@ -150,7 +150,7 @@ export default function useOnCompleteCallback() { if (hasCompulsoryDataElementOperandsToFillOut) { setCompleteAttempted(true) - cancelCompletionMutation() + cancelCompletionMutation({ completedBoolean: false }) promise = Promise.reject( new Error( i18n.t( diff --git a/src/shared/completion/use-imperative-cancel-completion-mutation.js b/src/shared/completion/use-imperative-cancel-completion-mutation.js index 552f67393..da5bb5a77 100644 --- a/src/shared/completion/use-imperative-cancel-completion-mutation.js +++ b/src/shared/completion/use-imperative-cancel-completion-mutation.js @@ -8,7 +8,7 @@ export default function useImperativeCancelCompletionMutation() { const mutationKey = useSetFormCompletionMutationKey() const dataValueSetQueryKey = useDataValueSetQueryKey() - return () => { + return ({ completedBoolean } = {}) => { const foundMutation = mutationCache.find({ mutationKey }) if (!foundMutation) { @@ -30,7 +30,7 @@ export default function useImperativeCancelCompletionMutation() { ...previousDataValueSet, completeStatus: { ...previousDataValueSet.completeStatus, - complete: !completed, + complete: completedBoolean ?? !completed, }, }) )