Skip to content

[Due for payment 2025-07-30] [$250] Remove remaining withOnyx HOCs from the project | Batch 4 #65964

Description

@fabioh8010

Parent issue: #64225

Let's refactor the following files to use useOnyx instead of withOnyx. All the work must be done in one PR.

After refactor please test them extensively and provide test steps in your PR. In case of questions please ask in #expensify-open-source channel.

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021944840312476435526
  • Upwork Job ID: 1944840312476435526
  • Last Price Increase: 2025-07-14
  • Automatic offers:
    • nkdengineer | Contributor | 108043525
Issue OwnerCurrent Issue Owner: @alitoshmatov

Activity

  1. nkdengineer commented on Jul 14, 2025

    @nkdengineer
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    Remove remaining withOnyx HOCs

    What is the root cause of that problem?

    We're using the deprecated HOCs here

    const IOURequestStepCurrencyWithOnyx = withOnyx<IOURequestStepCurrencyProps, IOURequestStepCurrencyOnyxProps>({

    const IOURequestStepTaxAmountPageWithOnyx = withOnyx<IOURequestStepTaxAmountPageProps, IOURequestStepTaxAmountPageOnyxProps>({

    What changes do you think we should make in order to solve the problem?

    Replace withOnyx with useOnyx and update the prop type accordingly

    const [draftTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {canBeMissing: true});
    const [recentlyUsedCurrencies] = useOnyx(ONYXKEYS.RECENTLY_USED_CURRENCIES, {canBeMissing: true});
    

    const IOURequestStepCurrencyWithOnyx = withOnyx<IOURequestStepCurrencyProps, IOURequestStepCurrencyOnyxProps>({
    draftTransaction: {
    key: ({route}) => {
    const transactionID = route?.params?.transactionID ?? -1;
    return `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`;
    },
    },
    recentlyUsedCurrencies: {
    key: ONYXKEYS.RECENTLY_USED_CURRENCIES,
    },
    })(IOURequestStepCurrency);
    /* eslint-disable rulesdir/no-negated-variables */

    const [splitDraftTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transactionID}`, {canBeMissing: true});
    const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report ? report.policyID : '-1'}`, {canBeMissing: true});
    const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report ? report.policyID : '-1'}`, {canBeMissing: true});
    const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${report ? report.policyID : '-1'}`, {canBeMissing: true});
    

    const IOURequestStepTaxAmountPageWithOnyx = withOnyx<IOURequestStepTaxAmountPageProps, IOURequestStepTaxAmountPageOnyxProps>({
    splitDraftTransaction: {
    key: ({route}) => {
    const transactionID = route?.params.transactionID ?? 0;
    return `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transactionID}`;
    },
    },
    policy: {
    key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report ? report.policyID : '-1'}`,
    },
    policyCategories: {
    key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report ? report.policyID : '-1'}`,
    },
    policyTags: {
    key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${report ? report.policyID : '-1'}`,
    },
    })(IOURequestStepTaxAmountPage);
    // eslint-disable-next-line rulesdir/no-negated-variables
    const IOURequestStepTaxAmountPageWithWritableReportOrNotFound = withWritableReportOrNotFound(IOURequestStepTaxAmountPageWithOnyx);

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    None

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  2. self-assigned this
    on Jul 14, 2025
  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 14, 2025
  4. changed the title [-]Remove remaining withOnyx HOCs from the project | Batch 4[/-] [+][$250] Remove remaining withOnyx HOCs from the project | Batch 4[/+] on Jul 14, 2025
  5. melvin-bot commented on Jul 14, 2025

    @melvin-bot
  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 14, 2025
  7. melvin-bot commented on Jul 14, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov (External)

  8. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 14, 2025
  9. melvin-bot commented on Jul 14, 2025

    @melvin-bot

    📣 @nkdengineer 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

    Offer link
    Upwork job
    Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
    Keep in mind: Code of Conduct | Contributing 📖

  10. 7 remaining items

  11. melvin-bot commented on Aug 1, 2025

    @melvin-bot

    @alitoshmatov Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  12. melvin-bot commented on Aug 5, 2025

    @melvin-bot

    @alitoshmatov Still overdue 6 days?! Let's take care of this!

  13. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 5, 2025
  14. roryabraham commented on Aug 5, 2025

    @roryabraham
    Contributor

    Marking as a bug to get help on payment

  15. melvin-bot commented on Aug 5, 2025

    @melvin-bot

    Triggered auto assignment to @OfstadC (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  16. roryabraham commented on Aug 5, 2025

    @roryabraham
    Contributor

    No C+ checklist needed here imo

  17. OfstadC commented on Aug 5, 2025

    @OfstadC
    Contributor

    Payment Summary

    Contributor: @nkdengineer paid $250 via Upwork
    Contributor+: @alitoshmatov due $250 via NewDot

  18. alitoshmatov commented on Aug 6, 2025

    @alitoshmatov
    Contributor

    Requested payment in ND

  19. trjExpensify commented on Aug 7, 2025

    @trjExpensify
    Contributor

    $250 approved for @alitoshmatov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions