Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/hooks/useOdometerDraftHydrator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {useEffect} from 'react';
import type {OnyxEntry} from 'react-native-onyx';
import type {IOURequestType} from '@userActions/IOU';
import {hydrateOdometerDraftIntoTransaction} from '@userActions/OdometerTransactionUtils';
import {hydrateOdometerDraftIntoTransaction, isOdometerDraftPendingHydration} from '@userActions/OdometerTransactionUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {OdometerDraft, Transaction} from '@src/types/onyx';
Expand Down Expand Up @@ -39,6 +39,13 @@ function useOdometerDraftHydrator({
if (lastHydratedDraft === odometerDraft) {
return;
}
// Skip when the comment already reflects the draft. saveOdometerDraft writes from the
// edit-from-confirmation flow otherwise mint fresh blob URLs via the serialize/deserialize
// round-trip and revoke the URLs the confirm page is currently displaying.
Comment on lines +42 to +44

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say that comment is more confusing than helping 😵‍💫 Typical Claude.

if (!isOdometerDraftPendingHydration(odometerDraft, transaction?.comment)) {
lastHydratedDraft = odometerDraft;
return;
}
hydrateOdometerDraftIntoTransaction(transaction?.transactionID ?? CONST.IOU.OPTIMISTIC_TRANSACTION_ID, odometerDraft, transaction?.comment);
lastHydratedDraft = odometerDraft;
// transaction.comment intentionally excluded — it changes after our own merge and would re-fire.
Expand Down
Loading