Open vincdargento opened 5 days ago
Triggered auto assignment to @michaelkwardrop (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.
🚨 Edited by proposal-police: This proposal was edited at 2025-02-07 01:49:32 UTC.
Expensify Card - Limit input page shows error after incorrect magic code is entered
When we enter invalid magic code, the BE response with this error without passing the policy id i.e issueNewExpensifyCard
only instead of issueNewExpensifyCard_policyID
:
And inside the validate code action modal we only showing an error:
Oops... something went wrong and your request could not be completed. Please try again later.
And when we close the validation modal we clear the error with the policy id https://github.com/Expensify/App/blob/27780d5a3c15ce3141d6ed3035cb4ed218f8f265/src/libs/actions/Card.ts#L403-L405
But since the BE doesn't response with policy id, it won't clear the errors
We should clear the issueNewExpensifyCard
only like the BE response
https://github.com/Expensify/App/blob/27780d5a3c15ce3141d6ed3035cb4ed218f8f265/src/libs/actions/Card.ts#L403-L405
Onyx.merge(`${ONYXKEYS.COLLECTION.ISSUE_NEW_EXPENSIFY_CARD}`, {errors: null});
Onyx.merge(`${ONYXKEYS.COLLECTION.ISSUE_NEW_EXPENSIFY_CARD}${policyID}`, {errors: null});
N/A
We should fix this in the BE passing the policy id in the response
Job added to Upwork: https://www.upwork.com/jobs/~021887634706743746932
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hungvu193 (External
)
Likely a Backend issue. I'll take a look this weekend.
The limit input page shows an error after an incorrect magic code is entered
In this PR, we decided to use many ISSUE_NEW_EXPENSIFYCARD{policyID} fields (adding policyID to the end) to distinguish the data between multiple workspaces.
But we forgot to update the BE to return the errors to correct ISSUE_NEW_EXPENSIFY_CARD_{policyID}
field. The BE always returns the errors to ISSUE_NEW_EXPENSIFY_CARD
field
Incoincident, ISSUE_NEW_EXPENSIFY_CARD is the source of data of the form
It means that FormProvider will get errors from ISSUE_NEW_EXPENSIFY_CARD
field automatically and display it
Update the BE to return errors to the correct ISSUE_NEW_EXPENSIFYCARD{policyID} field (with the correct policyID)
I search on the code base and see that ISSUE_NEW_EXPENSIFY_CARD_FORM is used in 2 places: Limit Step and Card Name Step.
I suggest using other form fields in 2 places. Using ISSUE_NEW_EXPENSIFY_CARD_FORM in two pages is not suitable because these two pages are independent of each other, If we use a form field in two places It means that all fields in that form will be shared with each other.
One more thing, currently ISSUE_NEW_EXPENSIFY_CARD_FORM matched to issueNewExpensifyCard field on Onyx but issueNewExpensifyCard is no longer used in our App anymore because of https://github.com/Expensify/App/pull/55482 (or on some edge case that the BE still return issueNewExpensifyCard field to FE like in this issue). These things may cause unexpected things to Limit Step and Card Name Step
Let's create two new form fields and use them in these places:
None
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Using ISSUE_NEW_EXPENSIFY_CARD_FORM in two pages is not suitable because these two pages are independent of each other, If we use a form field in two places It means that all fields in that form will be shared with each other.
What's the problem of sharing the formKey between screens? We're still doing it till now, you can easily find duplicate formKey almost everywhere. Ie: ISSUE_NEW_EXPENSIFY_CARD_FORM, NETSUITE_CUSTOM_SEGMENT_ADD_FORM, ....etc
We're still doing it till now, you can easily find duplicate formKey almost everywhere
Yes, we use the same Onyx form key in multiple forms in other places, but it only causes problems in some special cases like this bug (or some other unexpected things).
If there are any errors saved in ISSUE_NEW_EXPENSIFY_CARD_FORM, It will be displayed on both pages that I think it shouldn't happen because Limit step and card name step shouldn't have any mutual error
Using an independent Onyx form key will be the safest way with no downsides. This is the reason why I suggest that in my proposal
We have 2 ways to go:
Change the formKey only hides the error from the user interface the error is still there inside Onyx storage. Let's fix this from BE by returning the correct errorKey (with policy id).
🎀 👀 🎀
Triggered auto assignment to @lakchote, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
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: 9.0.94-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers): applausetester+230932@applause.expensifail.com Issue reported by: Applause Internal Team Device used: Mac 15.0 / Chrome App Component: Workspace Settings
Action Performed:
Precondition:
Expected Result:
Limit input page will not show error.
Actual Result:
Limit input page shows error - You must be a domain admin to create the virtual card.
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://github.com/user-attachments/assets/53d50139-be5f-4e90-bbcc-85a3b840fda5
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @hungvu193