Closed IuliiaHerets closed 1 month ago
Triggered auto assignment to @puneetlath (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.
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 (External
)
Edited by proposal-police: This proposal was edited at 2024-08-21 21:02:12 UTC.
Multi tags - "Required" switch is enabled after disabling all subtags & reopening subtag list
The required value is only toggled in the optimistic data, when the backend returns the response the required
value is again turned to required.
https://github.com/Expensify/App/blob/12037eef23dfb54b73d05ea28bd0b7334a7ca153/src/libs/actions/Policy/Tag.ts#L218C29-L218C53
https://github.com/Expensify/App/blob/12037eef23dfb54b73d05ea28bd0b7334a7ca153/src/libs/actions/Policy/Tag.ts#L230
https://github.com/Expensify/App/blob/12037eef23dfb54b73d05ea28bd0b7334a7ca153/src/libs/actions/Policy/Tag.ts#L257
required
value to the backend through parameters object.required
value accordingly.setPolicyTagsRequired
.
https://github.com/Expensify/App/blob/12037eef23dfb54b73d05ea28bd0b7334a7ca153/src/libs/actions/Policy/Tag.ts#L764-L769When all subtags are disabled, the "Required" toggle should be toggled off. However, it is currently showing as toggled on, which creates confusion for users.
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.
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:
if (!Object.values(currentPolicyTag?.tags ?? {}).some((tag) => tag.enabled)) {
Tag.setPolicyTagsRequired(policyID, false, route.params.orderWeight)
}
Here is the video afterMy Updates: https://github.com/user-attachments/assets/ad799020-db34-4c13-9ac5-65581db542c5
I think this is a BE bug since we can calculate required
value via tagListIndex
and tags
data as we do in optimistic data.
Disabling all subtags (individually or in bulk) should make the main tag not required.
We should update the required attribute on the main tag, if all the subtags are disabled but we are not.
I think the simplest solution is to just make a call to setPolicyTagsRequired
when all the subtags are disabled.
This should also handle the case when the user disable the subtags one by one as well.
So right after https://github.com/Expensify/App/blob/12037eef23dfb54b73d05ea28bd0b7334a7ca153/src/libs/actions/Policy/Tag.ts#L286
We can check if the tag should be marked as not required, then call:
if (shouldDisableRequiredTag) {
setPolicyTagsRequired(policyID, false, tagListIndex);
}
Handle this situation on the backend.
📣 @struc! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
♻️ Reviewing proposals.
✅ I've reviewed the existing proposals and we have the following two acceptable options:
Required
as disabled and locked.🎀👀🎀 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 https://github.com/Expensify/App/issues/47818#issuecomment-2304278094.
@puneetlath, @ikevin127 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
@puneetlath Callback to https://github.com/Expensify/App/issues/47818#issuecomment-2306068470, 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.
@Krishna2323's https://github.com/Expensify/App/issues/47818#issuecomment-2303004480 which proposes as solution to fix this from the BE side, since the FE already sends all the required parameters.
@ikevin127, just to clarify, we need to send requireTagList
param from the front-end, currently it's not included in the parameters.
I think I prefer the front-end solution. Let's go with that.
📣 @ikevin127 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!
📣 @Shahidullah-Muffakir You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing 📖
@puneetlath, the selected solution involves calling two API endpoints simultaneously. In my opinion, this approach could lead to multiple issues:
@ikevin127, what do you think?
♻️ I'm fine with CME's decision, if we encounter issues with the selected solution and we do need to have BE changes I'm sure we will sort things out here on the issue such that everybody is compensated fairily.
@Shahidullah-Muffakir Please us know when we can expect a PR to be ready for review 🧑💻
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.
@puneetlath @ikevin127
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 :
https://github.com/Expensify/App/blob/7dc25152d1595b7e58013de679fe26a7aa1634bd/src/pages/workspace/tags/WorkspaceTagsPage.tsx#L103
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.
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. :) Thanks again for your help!
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.
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 Required
staying OFF and Locked and not going back to being ON after the RHP is re-opened. Whether this should be considered regression or not, I'll defer that to @puneetlath.
https://github.com/user-attachments/assets/f3ac9b51-b468-4fb0-8615-c92c1da04f40
Doesn't sound like a regression to me.
⚠️ Automation failed here -> this should be on [HOLD for Payment 2024-09-17] according to 3 days ago production deploy from https://github.com/Expensify/App/issues/48664#issuecomment-2338463845 (the PR is part of the deploy checklist).
⚠️ We also don't have a BZ team member assigned for payment.
cc @puneetlath @garrettmknight
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?
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 contributors@expensify.com 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): applausetester+kh050806@applause.expensifail.com 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
https://github.com/user-attachments/assets/6bed2f7d-bc66-4c8b-95f6-ff1e9d1d5715
Bug6578591_1724267622842!Independent.-.Multi.Level.tags.csv
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @ikevin127