Skip to content

Commit

Permalink
Merge pull request #52691 from truph01/fix/52137
Browse files Browse the repository at this point in the history
fix: Tags - State field is not auto selected
  • Loading branch information
danieldoglas authored Nov 25, 2024
2 parents 70dfbb7 + f796b97 commit 0cb5a48
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function IOURequestStepConfirmation({
params: {iouType, reportID, transactionID, action, participantsAutoAssigned: participantsAutoAssignedFromRoute},
},
transaction,
isLoadingTransaction,
}: IOURequestStepConfirmationProps) {
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const personalDetails = usePersonalDetails() || CONST.EMPTY_OBJECT;
Expand Down Expand Up @@ -608,6 +609,10 @@ function IOURequestStepConfirmation({
createTransaction(listOfParticipants);
};

if (isLoadingTransaction) {
return <FullScreenLoadingIndicator />;
}

return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
Expand Down
10 changes: 8 additions & 2 deletions src/pages/iou/request/step/withFullTransactionOrNotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type SCREENS from '@src/SCREENS';
import type {Transaction} from '@src/types/onyx';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';

type WithFullTransactionOrNotFoundOnyxProps = {
/** Indicates whether the report data is loading */
transaction: OnyxEntry<Transaction>;

/** Indicates whether the transaction data is loading */
isLoadingTransaction?: boolean;
};

type MoneyRequestRouteName =
Expand Down Expand Up @@ -54,8 +58,9 @@ export default function <TProps extends WithFullTransactionOrNotFoundProps<Money
const userAction = 'action' in route.params && route.params.action ? route.params.action : CONST.IOU.ACTION.CREATE;

const shouldUseTransactionDraft = IOUUtils.shouldUseTransactionDraft(userAction);
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`);
const [transactionDraft] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`);
const [transaction, transactionResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`);
const [transactionDraft, transactionDraftResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`);
const isLoadingTransaction = isLoadingOnyxValue(transactionResult, transactionDraftResult);

const isFocused = useIsFocused();

Expand All @@ -70,6 +75,7 @@ export default function <TProps extends WithFullTransactionOrNotFoundProps<Money
// eslint-disable-next-line react/jsx-props-no-spreading
{...(props as TProps)}
transaction={shouldUseTransactionDraft ? transactionDraft : transaction}
isLoadingTransaction={isLoadingTransaction}
ref={ref}
/>
);
Expand Down

0 comments on commit 0cb5a48

Please sign in to comment.