Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2024-12-05] [$250] Tags - State field is not auto selected when there is only one tag #52137

Open
4 of 8 tasks
IuliiaHerets opened this issue Nov 6, 2024 · 36 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Overdue

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Nov 6, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.58-1
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5188086
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

Precondition:

  • Workspace is set up with dependent multi tags (use the file attached below).
  1. Launch hybrid or ND app.
  2. Go to workspace chat in which dependent multi tags are set up.
  3. Tap + > Submit expense > Manual.
  4. Enter amount > Next.

Expected Result:

State field will be auto selected with the only one tag because "Members must tag all expenses" in Tags settings is enabled. (It is auto selected on staging web and production hybrid).

Actual Result:

State field is not auto selected with the only one tag even when "Members must tag all expenses" in Tags settings is enabled.
This issue only happens on Android and iOS app (both hybrid and standalone).

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6656808_1730914735568.ScreenRecording_11-07-2024_01-33-18_1.mp4

Bug6656808_1730914735568!Dependent_-_Multi_Level_tags_NEW.csv

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021854535982635221591
  • Upwork Job ID: 1854535982635221591
  • Last Price Increase: 2024-11-14
  • Automatic offers:
    • truph01 | Contributor | 104908657
Issue OwnerCurrent Issue Owner: @strepanier03
@IuliiaHerets IuliiaHerets added the Bug Something is broken. Auto assigns a BugZero manager. label Nov 6, 2024
Copy link

melvin-bot bot commented Nov 6, 2024

Triggered auto assignment to @strepanier03 (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.

@melvin-bot melvin-bot bot added the Daily KSv2 label Nov 6, 2024
@IuliiaHerets IuliiaHerets changed the title iOS - Tags - State field is not auto selected when there is only one tag Tags - State field is not auto selected when there is only one tag Nov 6, 2024
@IuliiaHerets IuliiaHerets added DeployBlockerCash This issue or pull request should block deployment and removed Daily KSv2 labels Nov 6, 2024
Copy link

melvin-bot bot commented Nov 6, 2024

Triggered auto assignment to @danieldoglas (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented Nov 6, 2024

💬 A slack conversation has been started in #expensify-open-source

Copy link
Contributor

github-actions bot commented Nov 6, 2024

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@danieldoglas
Copy link
Contributor

@IuliiaHerets can you please post the video for it working in production as well? Thanks!

@IuliiaHerets
Copy link
Author

@danieldoglas Can you please check the added video? it includes the prod behavior too

@danieldoglas
Copy link
Contributor

Oh, I think I got confused because you downloaded both from test flight. Thanks for confirming

@truph01
Copy link
Contributor

truph01 commented Nov 7, 2024

Edited by proposal-police: This proposal was edited at 2024-11-11 11:05:40 UTC.

Proposal

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

  • Tags - State field is not auto selected when there is only one tag

What is the root cause of that problem?

  • This bug comes from PR, where we migrate to use useOnyx instead of withOnyx.
  • The transaction in this useEffect can be undefined (is still loading) because of the above migration, and because we removed the transaction data from the its dependences:

}, [policyTagLists, policyTags]);

so the useEffect is not called again once the transaction data is available.

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

  • In here:

const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`);

we can introduce a new variable to check whether we are loading transaction data:

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

and then pass down this variable to its child.

  • To address this more generally, a loading indicator should be shown if isLoadingTransaction is true in here:
    if (isLoadingTransaction) {
        return <FullScreenLoadingIndicator />;
    }

What alternative solutions did you explore? (Optional)

  • In here:

const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`);

we can introduce a new variable to check whether we are loading transaction data:

        const [transaction, transactionResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`);
        const [transactionDraft, transactionDraftResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`);
        const isLoadingTransaction = isLoadingOnyxValue(transactionResult, transactionDraftResult);
  • Then we pass down that variable to the useEffect:
    // Auto select the tag if there is only one enabled tag and it is required
    useEffect(() => {
        if(isLoadingTransaction){
            return
        }
        ...
    }, [policyTagLists, policyTags, isLoadingTransaction]);
  • With this change, we ensure consistent behavior with how withOnyx functions. The withOnyx() HOC delays rendering of the wrapped component until all specified keys/entities are fetched. Using useOnyx, we can similarly determine when the data is fully loaded by monitoring the isLoadingTransaction variable.

Also, this is our common solution when migrating withOnyx to useOnyx.

@Julesssss
Copy link
Contributor

Hey @danieldoglas I decided not to block on this as this is very easy for users to figure out -- simply select it manually as the violation suggests.

I think it can be made external to speed up the fix, we have a decent proposal already. We will also need to locate the regression though. I'm unsubscribing so please tag me if you need me 👋

@Julesssss Julesssss added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Nov 7, 2024
@danieldoglas danieldoglas added the External Added to denote the issue can be worked on by a contributor label Nov 7, 2024
@melvin-bot melvin-bot bot changed the title Tags - State field is not auto selected when there is only one tag [$250] Tags - State field is not auto selected when there is only one tag Nov 7, 2024
Copy link

melvin-bot bot commented Nov 7, 2024

Job added to Upwork: https://www.upwork.com/jobs/~021854535982635221591

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 7, 2024
Copy link

melvin-bot bot commented Nov 7, 2024

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

@klajdipaja
Copy link
Contributor

klajdipaja commented Nov 7, 2024

Proposal

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

Tag is not auto-selected on submit expense when the workspace has enabled required tags.

What is the root cause of that problem?

Initially, the component renders with transactionID=-1 which is then used in this block to add the required tag:

if (updatedTagsString !== TransactionUtils.getTag(transaction) && updatedTagsString) {
IOU.setMoneyRequestTag(transactionID, updatedTagsString);
}
.
As a consequence you can find on Onyx this key transactionsDraft_-1 which holds only the tag in the value:
{tag: 'tst'}

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

We need to update this useEffect dependencies to add the transcationId in it in this line:

}, [policyTagLists, policyTags]);

And to avoid creating the onyx entry for the -1 id we should add an early return in the useEffect:

if(transactionID === '-1'){
            return;
        }   

What alternative solutions did you explore? (Optional)

@hoangzinh
Copy link
Contributor

Thanks for your proposals. @truph01 @klajdipaja does anyone know why it only happens in native apps? It works for me in Web

@hoangzinh
Copy link
Contributor

After considering proposals, I think @truph01's proposal looks good to me. Showing a loading indicator seems to fix this issue and other similar issues properly.

Link to proposal #52137 (comment)

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Nov 13, 2024

Triggered auto assignment to @francoisl, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Nov 14, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 15, 2024
Copy link

melvin-bot bot commented Nov 15, 2024

📣 @truph01 🎉 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 📖

Copy link

melvin-bot bot commented Nov 18, 2024

@francoisl, @danieldoglas, @hoangzinh, @strepanier03, @truph01 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Nov 18, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 Overdue labels Nov 18, 2024
@truph01
Copy link
Contributor

truph01 commented Nov 18, 2024

PR is ready

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Nov 28, 2024
@melvin-bot melvin-bot bot changed the title [$250] Tags - State field is not auto selected when there is only one tag [HOLD for payment 2024-12-05] [$250] Tags - State field is not auto selected when there is only one tag Nov 28, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 28, 2024
Copy link

melvin-bot bot commented Nov 28, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Nov 28, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.67-9 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-12-05. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Nov 28, 2024

@hoangzinh @strepanier03 @hoangzinh The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Dec 5, 2024
@danieldoglas
Copy link
Contributor

@strepanier03 I think this is ready for payment

Copy link

melvin-bot bot commented Dec 10, 2024

@francoisl, @danieldoglas, @hoangzinh, @strepanier03, @truph01 Eep! 4 days overdue now. Issues have feelings too...

@hoangzinh
Copy link
Contributor

hoangzinh commented Dec 11, 2024

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] 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: https://github.com/Expensify/App/pull/51244/files#r1879738449

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    It was a DB, so I believe we already had a regression test for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Overdue
Projects
None yet
Development

No branches or pull requests

8 participants