You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Workspace - Single category and tag isn't auto selected when requesting money #40591
Version Number: 1.4.63.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: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Slack conversation:
@zanyrenney 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
Please re-state the problem that we are trying to solve in this issue.
Single category and tags aren't auto selected when requesting money.
What is the root cause of that problem?
Here when we have only one tag / one category we have a check which sets the auto selected value, but here before that we have certain conditions as below:
For Category:
When I debugged this I found out that !isCategoryRequired and isTagListRequired are always set to true, regardless of whatever we have set on the BE (In workspace category and tags page, when we set the values as required those values are successfully changed on the BE), so no issue on the BE.
Now coming to why values isCategoryRequired and isTagListRequired are always false regardless of the backend value, that is because we had added an extra check during the feature addition of categories and tags to only set those values to true if the user has beta access by checking the canUseViolations value, we check isCategoryRequired as well as isTagListRequired with canUseViolations and their respective BE values:
What changes do you think we should make in order to solve the problem?
We should remove the && canUseViolations from both isTagListRequired as well as isCategoryRequired
Result Video
Screen.Recording.2024-04-20.at.5.47.20.AM.mov
Now that I searched more, I think we should get rid of the canUseViolations hook altogether, because this also gives us regression, it doesn't make tags required (Even when we have required value on the BE):
What alternative solutions did you explore? (Optional)
Since iouCategory is defaulted to an empty string, we can initialize it to the only categories in the MoneyRequestConfirmationListProps if the enabledCategories is equal to one and categories are required.
Note
I noticed you can empty the tag and category for a brief moment before the backend reverts them.
Hence, I recommend we prohibit the ability to change the tag or category in this situation on the edit pages in the PR.
@cristipaval@ahmedGaber93@zanyrenney @GandalfGwaihir this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
I am not sure if we should have waited for @cristipaval to accept the proposal before move forward with PR, but as the contributor is assigned to the issue and the PR is already started, I am going to review the PR, and we can move any discussion there.
Activity
melvin-bot commentedon Apr 19, 2024
Triggered auto assignment to @zanyrenney (
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.lanitochka17 commentedon Apr 19, 2024
@zanyrenney 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
lanitochka17 commentedon Apr 19, 2024
We think that this bug might be related to #wave-collect - Release 1
Krishna2323 commentedon Apr 19, 2024
allgandalf commentedon Apr 20, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Single category and tags aren't auto selected when requesting money.
What is the root cause of that problem?
Here when we have only one tag / one category we have a check which sets the auto selected value, but here before that we have certain conditions as below:
For Category:
App/src/components/MoneyRequestConfirmationList.tsx
Lines 489 to 491 in 8699315
For Tag:
App/src/components/MoneyRequestConfirmationList.tsx
Lines 501 to 504 in 8699315
When I debugged this I found out that
!isCategoryRequiredandisTagListRequiredare always set to true, regardless of whatever we have set on theBE(In workspace category and tags page, when we set the values as required those values are successfully changed on theBE), so no issue on theBE.Now coming to why values
isCategoryRequiredandisTagListRequiredare alwaysfalseregardless of the backend value, that is because we had added an extra check during the feature addition ofcategoriesandtagsto only set those values totrueif the user hasbetaaccess by checking thecanUseViolationsvalue, we checkisCategoryRequiredas well asisTagListRequiredwithcanUseViolationsand their respectiveBEvalues:App/src/components/MoneyRequestConfirmationList.tsx
Line 296 in 8699315
App/src/components/MoneyRequestConfirmationList.tsx
Line 501 in 8699315
This causes the values to be always set to
false.What changes do you think we should make in order to solve the problem?
We should remove the
&& canUseViolationsfrom bothisTagListRequiredas well asisCategoryRequiredResult Video
Screen.Recording.2024-04-20.at.5.47.20.AM.mov
Now that I searched more, I think we should get rid of the
canUseViolationshook altogether, because this also gives us regression, it doesn't make tags required (Even when we have required value on theBE):App/src/components/MoneyRequestConfirmationList.tsx
Line 797 in 8699315
So I guess we should remove the use of hook from the page as the
categoriesandtagsforcollect policyare no longer inbetaTony-MK commentedon Apr 20, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Workspace - Single category and tag isn't auto selected when requesting money
What is the root cause of that problem?
This is a regression caused by #40217 and was suggested in #38744 (comment).
iouCategoryandtransactionIDshould be included in the category dependencies required because theiouCategorywill change after the first render.App/src/components/MoneyRequestConfirmationList.tsx
Lines 515 to 523 in 1e510b5
The tag field does not have this issue because the dependencies are set properly.
App/src/components/MoneyRequestConfirmationList.tsx
Lines 537 to 539 in 1e510b5
This is why I only experienced this with the category field.
I believe the category dependencies should not have the
eslint ruleline like the tag dependencies`.What changes do you think we should make in order to solve the problem?
First, add
iouCategoryandtransactionIDas apart dependencies.Hence, it should look like the code example below.
Finally, remove the
eslint ruleline below because there will be no dependency issues.App/src/components/MoneyRequestConfirmationList.tsx
Line 522 in 1e510b5
What alternative solutions did you explore? (Optional)
Since
iouCategoryis defaulted to an empty string, we can initialize it to the only categories in theMoneyRequestConfirmationListPropsif theenabledCategoriesis equal to one and categories are required.Note
I noticed you can empty the tag and category for a brief moment before the backend reverts them.
Hence, I recommend we prohibit the ability to change the tag or category in this situation on the edit pages in the PR.
POC.-.Chrome.mov
Krishna2323 commentedon Apr 20, 2024
Proposal Updated
Krishna2323 commentedon Apr 20, 2024
@Tony-MK, I don't think that it is a regression from my PR, can you pls explain why do you think that it is regression?
Tony-MK commentedon Apr 22, 2024
Hey @krishna232, the
useEffectneeds theiouCategorydependency like theuseEffectfor the tags hook.zanyrenney commentedon Apr 22, 2024
adding external label
37 remaining items
melvin-bot commentedon May 3, 2024
@cristipaval @ahmedGaber93 @zanyrenney @GandalfGwaihir this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
allgandalf commentedon May 3, 2024
Chill Melvin!, PR would be ready in 1 hour :)
allgandalf commentedon May 5, 2024
PR ready for review c.c. @ahmedGaber93 , sorry got under the weather at the time of the above message, feeling better now 😃
ahmedGaber93 commentedon May 6, 2024
I am not sure if we should have waited for @cristipaval to accept the proposal before move forward with PR, but as the contributor is assigned to the issue and the PR is already started, I am going to review the PR, and we can move any discussion there.
allgandalf commentedon May 23, 2024
allgandalf commentedon May 29, 2024
I think this is ready for payment @zanyrenney , can you take a look once you find time 😄
Update:
Their GH says they're OoO until June 9, so maybe lets hold this until then, have great vacation @zanyrenney 🏖️
allgandalf commentedon Jun 12, 2024
Can you pay this out please @zanyrenney, hope you enjoyed your time out :)
zanyrenney commentedon Jun 19, 2024
Hey @allgandalf thanks for checking the status, great thing to do :) I was also then at a conference so i appreciate your patience.
zanyrenney commentedon Jun 19, 2024
not sure why @dukenv0307 is on the Upwork listingm because the payments should be
@allgandalf as contributor
@ahmedGaber93 as contributor+
paying out as per these assignments:
zanyrenney commentedon Jun 19, 2024
paid @ahmedGaber93 $250
paid @allgandalf $250
closing!