Skip to content

[HOLD for payment 2024-07-10] [$250] Category - "Category no longer valid" shows up briefly after changing amount #43767

Closed

Description

@izarutskaya

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.83-0
Reproducible in staging?: Y
Reproducible in production?: Y
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

Precondition:

  • "Members must categorize all expenses" in Categories is enabled.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Submit an expense with category.
  4. Go to transaction thread.
  5. Click Amount.
  6. Change amount and save it.

Expected Result:

There will be no violation under Category after changing amount because Category is already selected.

Actual Result:

"Category no longer valid" shows up briefly after changing amount when the selected category is valid.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6513040_1718362398903.bandicam_2024-06-14_18-44-14-234.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017067ba3b0cc2101a
  • Upwork Job ID: 1803116505548368516
  • Last Price Increase: 2024-06-18
  • Automatic offers:
    • allgandalf | Contributor | 102815523
    • truph01 | Contributor | 102828819
Issue OwnerCurrent Issue Owner: @OfstadC

Activity

  1. added
    Daily
    Bug
    on Jun 14, 2024
  2. melvin-bot commented on Jun 14, 2024

    @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.

  3. izarutskaya commented on Jun 14, 2024

    @izarutskaya
    Author

    We think this issue might be related to the #collect project.

  4. Nodebrute commented on Jun 14, 2024

    @Nodebrute
    Contributor

    Proposal

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

    "Category no longer valid" shows up briefly after changing amount

    What is the root cause of that problem?

    We are not passing policyCategories here

    IOU.updateMoneyRequestAmountAndCurrency({transactionID, transactionThreadReportID: reportID, currency, amount: newAmount, taxAmount, policy, taxCode});

    so in here policyCategories will be null
    data = getUpdateMoneyRequestParams(transactionID, transactionThreadReportID, transactionChanges, policy ?? null, policyTagList ?? null, policyCategories ?? null, true);

    So that's why when here we check for policyCategories?.[categoryKey]?.enabled it will be undefined

    const isCategoryInPolicy = categoryKey ? policyCategories?.[categoryKey]?.enabled : false;

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

    We should pass policyCategories here

    IOU.updateMoneyRequestAmountAndCurrency({transactionID, transactionThreadReportID: reportID, currency, amount: newAmount, taxAmount, policy, taxCode});

    Additionally we can also pass policyTags

    We can do something like this

            IOU.updateMoneyRequestAmountAndCurrency({transactionID, transactionThreadReportID: reportID, currency, amount: newAmount, taxAmount, policy,policyTags,policyCategories, taxCode});
    

    Note: This is just pseudocode.

       policyCategories: {
            key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report ? report.policyID : '-1'}`,
        },
        policyTags: {
            key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY_TAGS}${report ? report.policyID : '-1'}`,
        },
    

    We can also fix other instances of this to ensure we are passing all the data.

    What alternative solutions did you explore? (Optional)

  5. added
    Needs Reproduction
    retest-weekly
    on Jun 14, 2024
  6. MelvinBot commented on Jun 14, 2024

    @MelvinBot
    Contributor

    This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

  7. OfstadC commented on Jun 14, 2024

    @OfstadC
    Contributor

    I'm not able to reproduce on staging

    I've tried different currencies, having a tag field, no tag field. Clicking in to edit the expense a few different ways - but I never see the category error
    Most recent attempt:
    https://github.com/Expensify/App/assets/11722379/90d898f4-5194-489b-bf8b-c3b11e0f5a27

  8. Nodebrute commented on Jun 14, 2024

    @Nodebrute
    Contributor

    Hey @OfstadC, It's easily reproducible on staging. Try it with this precondition.
    Precondition: "Members must categorize all expenses" in Categories is enabled.

  9. OfstadC commented on Jun 14, 2024

    @OfstadC
    Contributor

    Let me give it another shot! 😃

  10. OfstadC commented on Jun 14, 2024

    @OfstadC
    Contributor

    I missed the "...must categorize all expenses" detail 🤦‍♀️ . It is very reproducible 😅
    categoryError

  11. removed
    Needs Reproduction
    retest-weekly
    on Jun 14, 2024
  12. 41 remaining items

  13. melvin-bot commented on Jul 3, 2024

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@allgandalf] The PR that introduced the bug has been identified. Link to the PR:
    • [@allgandalf] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • [@allgandalf] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
    • [@allgandalf] Determine if we should create a regression test for this bug.
    • [@allgandalf] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@OfstadC] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/411747
  14. OfstadC commented on Jul 9, 2024

    @OfstadC
    Contributor

    @allgandalf Could you please update this today based on the checklist? Thank you! 😃

  15. allgandalf commented on Jul 10, 2024

    @allgandalf
    Contributor

    Regression Test Proposal

    • Precondition : "Members must categorize all expenses" in Categories is enabled.
    1. Go to staging.new.expensify.com
    2. Go to workspace chat.
    3. Submit an expense with category.
    4. Go to transaction thread.
    5. Click Amount.
    6. Change amount and save it.
    7. Verify that there is no violation under Category after changing amount because Category is already selected.

    Do we agree 👍 or 👎

  16. added
    Daily
    and removed
    Weekly
    on Jul 10, 2024
  17. OfstadC commented on Jul 10, 2024

    @OfstadC
    Contributor

    Payment Summary:
    Contributor: @allgandalf paid $250 via Upwork
    Contributor: @truph01 paid $250 via Upwork

  18. OfstadC commented on Jul 11, 2024

    @OfstadC
    Contributor

    Leaving this open until regression testing is complete

  19. OfstadC commented on Jul 15, 2024

    @OfstadC
    Contributor

    Same - waiting on regression testing

  20. melvin-bot commented on Jul 15, 2024

    @melvin-bot

    @deetergp, @OfstadC, @allgandalf, @truph01 Eep! 4 days overdue now. Issues have feelings too...

  21. allgandalf commented on Jul 15, 2024

    @allgandalf
    Contributor

    Chill a little melvin

  22. OfstadC commented on Jul 16, 2024

    @OfstadC
    Contributor

    I'm actually going to close this out. but I'll note here if the regression testing yields anything 😄

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions