Skip to content

Commit eae836a

Browse files
committed
Prevent stale Gusto sync result modal
1 parent a2ced94 commit eae836a

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/hooks/useGustoSyncResultsModal.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ function useGustoSyncResultsModal(policyID: string, connectionSyncProgress: Onyx
1616
connectionSyncProgress?.connectionName === CONST.POLICY.CONNECTIONS.NAME.GUSTO &&
1717
connectionSyncProgress?.stageInProgress === CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME.JOB_DONE &&
1818
!!syncResult;
19-
const wasSameGustoResultAlreadyHandled =
19+
const didTransitionToJobDone =
2020
previousSyncProgress?.connectionName === CONST.POLICY.CONNECTIONS.NAME.GUSTO &&
21-
previousSyncProgress?.stageInProgress === CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME.JOB_DONE &&
22-
previousSyncProgress?.timestamp === connectionSyncProgress?.timestamp &&
23-
!!previousSyncProgress?.result;
24-
const didGustoSyncComplete = isFocused && isGustoSyncDoneWithResult && !wasSameGustoResultAlreadyHandled;
21+
previousSyncProgress?.stageInProgress !== CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME.JOB_DONE;
22+
const didGustoSyncComplete = isFocused && isGustoSyncDoneWithResult && didTransitionToJobDone;
2523

2624
if (!didGustoSyncComplete || !syncResult) {
2725
return;
@@ -40,9 +38,7 @@ function useGustoSyncResultsModal(policyID: string, connectionSyncProgress: Onyx
4038
isFocused,
4139
policyID,
4240
previousSyncProgress?.connectionName,
43-
previousSyncProgress?.result,
4441
previousSyncProgress?.stageInProgress,
45-
previousSyncProgress?.timestamp,
4642
showModal,
4743
]);
4844
}

0 commit comments

Comments
 (0)