From cdeaaef5129378cba7a5bfef89accaeb15a999e6 Mon Sep 17 00:00:00 2001 From: sepeterson <10458078+sepeterson@users.noreply.github.com> Date: Fri, 8 May 2026 11:33:38 -0500 Subject: [PATCH] MOB-1396: first pass --- .../IdentificationSheets.tsx | 16 ++++++++++------ .../Sheets/AgreeWithIDSheet.js | 6 ++++++ .../Sheets/PotentialDisagreementSheet.tsx | 4 +++- .../Sheets/SuggestIDSheet.tsx | 6 ++++++ .../SharedComponents/Sheets/RadioButtonSheet.tsx | 5 ++++- .../IdentificationSheets.test.js | 4 ++++ 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/components/ObsDetailsDefaultMode/IdentificationSheets.tsx b/src/components/ObsDetailsDefaultMode/IdentificationSheets.tsx index ee26ab7f8..ec37aba91 100644 --- a/src/components/ObsDetailsDefaultMode/IdentificationSheets.tsx +++ b/src/components/ObsDetailsDefaultMode/IdentificationSheets.tsx @@ -233,7 +233,10 @@ const IdentificationSheets: React.FC = ( { cancelable: true, } ), [t] ); - const { mutate: createIdentificationMutate } = useAuthenticatedMutation( + const { + mutate: createIdentificationMutate, + isPending: isCreateIdPending, + } = useAuthenticatedMutation( ( idParams, optsWithAuth ) => createIdentification( idParams, optsWithAuth ), { onSuccess: data => { @@ -252,7 +255,8 @@ const IdentificationSheets: React.FC = ( { showErrorAlert( error ); }, onSettled: () => { - // Clear params gotten via useRoute to prevent re-showing sheets + dispatch( { type: SUBMIT_IDENTIFICATION } ); + closeAgreeWithIdSheet( ); navigation.setParams( { identAt: undefined, identTaxonId: undefined, identTaxonFromVision: undefined }, ); @@ -334,16 +338,13 @@ const IdentificationSheets: React.FC = ( { loadActivityItem( ); createIdentificationMutate( { identification: agreeParams } ); - closeAgreeWithIdSheet( ); - }, [closeAgreeWithIdSheet, createIdentificationMutate, observation?.uuid, loadActivityItem] ); + }, [createIdentificationMutate, observation?.uuid, loadActivityItem] ); const potentialDisagreeSheetDiscardChanges = useCallback( ( ) => { dispatch( { type: HIDE_POTENTIAL_DISAGREEMENT_SHEET } ); }, [] ); const doSuggestId = useCallback( ( potentialDisagree?: boolean ) => { - dispatch( { type: SUBMIT_IDENTIFICATION } ); - if ( !newIdentification?.taxon ) { throw new Error( "Cannot create an identification without a taxon" ); } @@ -422,6 +423,7 @@ const IdentificationSheets: React.FC = ( { onAgree={onAgree} editIdentBody={editIdentBody} hidden={showIdentBodySheet} + loading={isCreateIdPending} onPressClose={closeAgreeWithIdSheet} identification={agreeIdentification} /> @@ -454,6 +456,7 @@ const IdentificationSheets: React.FC = ( {