-
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
[$250] Report fields - Incorrect list value editor opens after renaming the list value #49546
Comments
Triggered auto assignment to @isabelastisser ( |
@isabelastisser 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 |
ProposalPlease re-state the problem that we are trying to solve in this issue.Incorrect list value editor opens after renaming the list value What is the root cause of that problem?We currently navigate to the report field value page using the index value. However, when we update the report field value, the order of the report field list changes, which also alters the index of the current value. What changes do you think we should make in order to solve the problem?We should indicate the report value page (setting page, edit name page,....) by its name rather than its index value. Here’s what we need to do:
What alternative solutions did you explore? (Optional) |
ProposalPlease re-state the problem that we are trying to solve in this issue.List value B opens after renaming list value C to A. What is the root cause of that problem?We have an error with method Onyx when merging list like ['c', 'a', 'b'] it saves as ['a', 'b', 'c'] What changes do you think we should make in order to solve the problem?We should display based on field name rather than index value by
What alternative solutions did you explore? (Optional)Simply, we can recalculate the |
Job added to Upwork: https://www.upwork.com/jobs/~021837218246278248735 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @rushatgabhane ( |
@cretadn22 is there some sort of ID that we can use instead of name to navigate? please see what data we have available for the Onyx key |
@rushatgabhane When creating the report field list, we store the draft data in workspaceReportFieldForm, and I don't see any additional IDs. |
c+ reviewed @cretadn22's proposal #49546 (comment) 🎀👀🎀 |
Triggered auto assignment to @johnmlee101, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
@cretadn22 let's use newName and oldName to set optimistic / success and failure data |
ProposalPlease re-state the problem that we are trying to solve in this issue.Report fields - Incorrect list value editor opens after renaming the list value What is the root cause of that problem?With introduction of Expensify/react-native-onyx#567, we started to use shared connection value. But in
we have used in place sorting which fools the values order when merging here App/src/libs/actions/Policy/ReportField.ts Lines 101 to 104 in 513e6b3
Onyx when merging list like What changes do you think we should make in order to solve the problem?We will use a copy instead here
const listValues = [...(formDraft?.[INPUT_IDS.LIST_VALUES] ?? [])].sort(localeCompare).join(', '); So it will perform in place sorting on a copy instead What alternative solutions did you explore? (Optional)NA |
@rushatgabhane You may need to re-evaluate your decision. |
I think both solutions would work. Routes based on index is a bit fragile, don't you think? @johnmlee101 @shubham1206agra
Because if Onyx changes, and then this hack would not work. Do you see any cons for the route based on the name of list value? cc: @cretadn22 |
Yeah, there are cons. The first con is to change the route entry in the navigator if someone changes the name. Second con is what if the request fails and the value gets reverted to the old one. It would show not found page. Plus, why should we rewrite the navigation routes for such a small reason which can be solved easily without any workaround. |
That is a fair point 👍 @johnmlee101 i like @shubham1206agra's proposal. It makes a copy, so even if onyx changes, this solution will still work. |
📣 @shubham1206agra 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
Sorry, I missed the assignment notification. I will raise the PR toady. |
Payment summary: @shubham1206agra $250 for PR, paid in Upwork. |
@rushatgabhane, do we need a regression test? |
yes i think we should add a regression step here because this bug is easy to happen if someone decides to refactor / simplify the logic |
|
all set! |
$250 approved for @rushatgabhane |
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.39-0
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
List value A (previously C) will open after renaming list value C to A.
Actual Result:
List value B opens after renaming list value C to A.
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6609930_1726837303619.20240920_205727.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @rushatgabhaneThe text was updated successfully, but these errors were encountered: