-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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-09-17] [$250] Multi tags - "Required" switch is enabled after disabling all subtags & reopening subtag list #47818
Comments
Triggered auto assignment to @puneetlath ( |
We think that this bug might be related to #wave-collect - Release 1 |
@puneetlath FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
Job added to Upwork: https://www.upwork.com/jobs/~0135a412ea484831b7 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ikevin127 ( |
Edited by proposal-police: This proposal was edited at 2024-08-21 21:02:12 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Multi tags - "Required" switch is enabled after disabling all subtags & reopening subtag list What is the root cause of that problem?The required value is only toggled in the optimistic data, when the backend returns the response the App/src/libs/actions/Policy/Tag.ts Line 230 in 12037ee
App/src/libs/actions/Policy/Tag.ts Line 257 in 12037ee
What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional)Result |
ProposalPlease re-state the problem that we are trying to solve in this issue.When all subtags are disabled, the "Required" toggle should be toggled off. However, it is currently showing as toggled on, which creates confusion for users. What is the root cause of that problem?Currently, the "Required" state is only updated when the user manually toggles the Required Toggle. The setPolicyTagsRequired function is invoked solely when the user interacts with the toggle. Consequently, when all subtags are disabled, this function is not called, resulting in the "Required" toggle remaining on. To update the "Required" state correctly, we should call this function whenever getHeaderButtons is executed. If the number of enabled tags is zero, the required button should be turned off. What changes do you think we should make in order to solve the problem?To address this issue, we can implement a check to see if any tags are enabled. If not, we should call the setPolicyTagsRequired function to turn off the required toggle. The suggested code change is as follows:
Here is the video afterMy Updates: |
I think this is a BE bug since we can calculate |
ProposalPlease re-state the problem that we are trying to solve in this issue.Disabling all subtags (individually or in bulk) should make the main tag not required. What is the root cause of that problem?We should update the required attribute on the main tag, if all the subtags are disabled but we are not. What changes do you think we should make in order to solve the problem?I think the simplest solution is to just make a call to So right after App/src/libs/actions/Policy/Tag.ts Line 286 in 12037ee
We can check if the tag should be marked as not required, then call: if (shouldDisableRequiredTag) {
setPolicyTagsRequired(policyID, false, tagListIndex);
} What alternative solutions did you explore? (Optional)Handle this situation on the backend. |
📣 @struc! 📣
|
✅ Contributor details stored successfully. Thank you for contributing to Expensify! |
This comment was marked as outdated.
This comment was marked as outdated.
✅ I've reviewed the existing proposals and we have the following two acceptable options:
I need some help from the assigned CME here to decide the final way to go, I tend to lean towards the first proposal as the right way to do this.🎀👀🎀 C+ reviewed |
Current assignee @puneetlath is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new. |
@struc Thanks for your proposal. Unfortunately we're generally are not in favour of having separate calls as a result of one call which already sends all the required parameters needed in order to fix this issue from the BE side as mentioned in #47818 (comment). |
@puneetlath, @ikevin127 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
@puneetlath Callback to #47818 (comment), we need to decide which way to go with this issue. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@puneetlath, friendly bump to check this comment.
@ikevin127, just to clarify, we need to send |
I think I prefer the front-end solution. Let's go with that. |
Thank you, I will submit the PR within 24 hours. |
@puneetlath / @ikevin127 might have a regression here |
@Shahidullah-Muffakir can you take a look? |
@Shahidullah-Muffakir Can you please look into the regression issue and if it indeed comes from our PR, you'd need to have a follow-up PR to fix the regression. Thanks in advance! |
@puneetlath @ikevin127 checking it out now. |
To hide the "Required" label when all tags are disabled, we should implement a similar check to what we applied for the Required toggle. The current check only verifies if the policyTagList is required, but it doesn't account for the scenario where all subtags are disabled in this :
We can update the logic as follows: labelText={policyTagList.required && !!Object.values(policyTagList?.tags ?? {}).some((tag) => tag.enabled) ? translate('common.required') : undefined} This way, the label will only appear if the main tag is required and at least one subtag is enabled. Additionally, I'm not sure if this issue is a regression—it seems more like a separate bug that was overlooked in the previous implementation. |
Screen.20Recording.202024-09-06.20at.2011.mp4 |
Making the PR in few minutes |
@ikevin127 Could you guide me on the process for submitting a fix? Should I go ahead and create a PR directly, or is there anything else I need to do before proceeding? Thank you. |
@Shahidullah-Muffakir Sure, you can go ahead and open a follow-up PR, tagging the other issue in the FIXED ISSUE section and leave blank for proposal - anything else is the same as any other PR. You can also post in the other issue once you opened the PR to let people know that you opened PR with a fix as a follow-up. Whether the issue was caused by your initial PR or not, we will determine soon and depending on the result we both will either have a penalty here (-50%) if it was indeed caused by the initial PR or possibly no penalty and a separate bounty for the other issue if it was indeed present before the initial changes. |
Thanks for the clarification, @ikevin127! I’ve already opened the follow-up PR and tagged the other issue. I hope this issue wasn’t caused by my initial PR and that it doesn’t lead to a penalty. :) |
Regarding the regression, just looked into whether the issue exists on production where the PR was not deployed yet and it looks like it does, meaning the bug was indeed overlooked in a previous implementation (see video below). The reason it surfaced now is because we fixed the issue of prod.mov |
Doesn't sound like a regression to me. |
|
Updated the title. I'm a BZ member so I can handle payment. (I'm a bit different than most in that I'm both on the BZ team and on the engineering team). |
cc @puneetlath |
@ikevin127 can you complete the checklist? |
Regression Test Proposal
Do we agree 👍 or 👎. cc @puneetlath |
@ikevin127 has been paid. @Shahidullah-Muffakir your offer is here: https://www.upwork.com/nx/wm/offer/104071660. Please ping me on this issue when you've accepted it. |
@puneetlath Offer aceepted, Thank you! |
Great, all paid. Thanks everyone! |
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: v9.0.23-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp https://expensify.testrail.io/index.php?/tests/view/4880485
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Action Performed:
Precondition:
Expected Result:
"Required" switch will remain locked and disabled.
Actual Result:
Required" switch is enabled after disabling all subtags & reopening subtag list.
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6578591_1724267622859.20240822_030758.mp4
Bug6578591_1724267622842!Independent.-.Multi.Level.tags.csv
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @ikevin127The text was updated successfully, but these errors were encountered: