Skip to content

[HOLD for payment 2025-01-24] [$250] Report fields -System message shows undefined when list value is changed back to initial value #47067

Closed

Description

@IuliiaHerets

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.18-1
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Submit two expenses.
  4. Go to workspace settings > Report fields (enable in More features).
  5. Add a list type report field, with some list values and an initial value.
  6. Return to the workspace chat.
  7. Go to expense report.
  8. Click on the list report field.
  9. Select a different list value.
  10. Revisit the report.
  11. Click on the list report field.
  12. Click on the already selected value (so that it will change to the initial value).
  13. Revisit the report.

Expected Result:

The system message will not contain "undefined".

Actual Result:

The system message contains "undefined" when the list value is changed back to the initial value.

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6565437_1723109214472.20240808_172103.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014a67065c97e4bdba
  • Upwork Job ID: 1822942704704377446
  • Last Price Increase: 2024-08-19
  • Automatic offers:
    • dukenv0307 | Reviewer | 103641179
    • nkdengineer | Contributor | 103641182
    • etCoderDysto | Contributor | 105612296
Issue OwnerCurrent Issue Owner: @dukenv0307

Activity

  1. added
    Daily
    Bug
    on Aug 8, 2024
  2. melvin-bot commented on Aug 8, 2024

    @melvin-bot

    Triggered auto assignment to @bfitzexpensify (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.

  3. IuliiaHerets commented on Aug 8, 2024

    @IuliiaHerets
    Author

    We think that this bug might be related to #wave-control

  4. IuliiaHerets commented on Aug 8, 2024

    @IuliiaHerets
    Author

    @bfitzexpensify 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

  5. etCoderDysto commented on Aug 8, 2024

    @etCoderDysto
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-08-08 13:17:27 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    System message shows undefined when list value is changed back to initial value

    What is the root cause of that problem?

    When selecting the same value (fieldValue === option.text), we assign empty string to fieldKey and pass it to the submit function

    onSelectRow={(option) => onSubmit({[fieldKey]: !option?.text || fieldValue === option.text ? '' : option.text})}

    Then when value is an empty string we assign null to value prop, update the BE with with a new reportField that has null as a value
    const handleReportFieldChange = (form: FormOnyxValues<typeof ONYXKEYS.FORMS.REPORT_FIELDS_EDIT_FORM>) => {
    const value = form[fieldKey];
    if (isReportFieldTitle) {
    ReportActions.updateReportName(report.reportID, value, report.reportName ?? '');
    Navigation.goBack();
    } else {
    ReportActions.updateReportField(report.reportID, {...reportField, value: value === '' ? null : value}, reportField);

    Then BE returns a report action object that have null on originalMessage.newValue prop

    What changes do you think we should make in order to solve the problem?

    We should remove

    || fieldValue === option.text
    

    from

    onSelectRow={(option) => onSubmit({[fieldKey]: !option?.text || fieldValue === option.text ? '' : option.text})}

    Or we should change it to

     onSelectRow={(option) => onSubmit({[fieldKey]: option?.text  ??  '' })}
    

    What alternative solutions did you explore? (Optional)

    We can dismiss the modal when value is an empty string

    if (value) {
    ReportActions.updateReportField(report.reportID, {...reportField, value}, reportField);
                }
    Navigation.dismissModal(report?.reportID);
  6. nkdengineer commented on Aug 8, 2024

    @nkdengineer
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-08-08 13:11:00 UTC.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The system message contains "undefined" when the list value is changed back to the initial value.

    What is the root cause of that problem?

    If the selected value is the current value of the report field, we pass it as empty string here

    onSelectRow={(option) => onSubmit({[fieldKey]: !option?.text || fieldValue === option.text ? '' : option.text})}

    Then here we pass the new value of the report field as null

    ReportActions.updateReportField(report.reportID, {...reportField, value: value === '' ? null : value}, reportField);

    So BE returns the new value in report action as null. Then when merging data to Onyx, the newValue field is deleted since it has null value.

    Screenshot 2024-08-08 at 20 02 25

    It leads newValue being undefined when we get the message here

    return Localize.translateLocal('report.actions.type.changeField', {oldValue, newValue, fieldName});

    What changes do you think we should make in order to solve the problem?

    We should add another case when the new value doesn't exist to display a message like remove the ${fieldName} (previously "${oldValue}"). We also need to create a new translation key for this message

    if (!newValue) {
        return // translated message;
    }
    

    if (!oldValue) {

    What alternative solutions did you explore? (Optional)

    We can do nothing if the user select the selected value

    onSelectRow={(option) => {
        if (fieldValue === option.text || !option?.text) {
            return;
        }
        onSubmit({[fieldKey]: option.text})
    }} 
    

    onSelectRow={(option) => onSubmit({[fieldKey]: !option?.text || fieldValue === option.text ? '' : option.text})}
    initiallyFocusedOptionKey={selectedOptionKey ?? undefined}

  7. nkdengineer commented on Aug 8, 2024

    @nkdengineer
    Contributor

    Updated proposal

    • Detail the RCA
  8. etCoderDysto commented on Aug 8, 2024

    @etCoderDysto
    Contributor

    Updated proposal

    • Added an alternative solution
  9. added
    External
    on Aug 12, 2024
  10. changed the title [-]Report fields -System message shows undefined when list value is changed back to initial value[/-] [+][$250] Report fields -System message shows undefined when list value is changed back to initial value[/+] on Aug 12, 2024
  11. melvin-bot commented on Aug 12, 2024

    @melvin-bot
  12. added
    Help Wanted
    on Aug 12, 2024
  13. 162 remaining items

  14. melvin-bot commented on Jan 17, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.86-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-01-24. 🎊

    For reference, here are some details about the assignees on this issue:

  15. melvin-bot commented on Jan 17, 2025

    @melvin-bot

    @dukenv0307 @bfitzexpensify @dukenv0307 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  16. moved this from Bugs and Follow Up Issues to Hold for Payment in #expensify-bugson Jan 21, 2025
  17. added
    Daily
    and removed
    Weekly
    on Jan 24, 2025
  18. melvin-bot commented on Jan 27, 2025

    @melvin-bot

    @cead22, @grgia, @bfitzexpensify, @dukenv0307, @dubielzyk-expensify, @nkdengineer, @etCoderDysto Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  19. bfitzexpensify commented on Jan 27, 2025

    @bfitzexpensify
    Contributor

    @dukenv0307 bump on the BZ checklist

  20. bfitzexpensify commented on Jan 27, 2025

    @bfitzexpensify
    Contributor

    Payments complete to @nkdengineer @etCoderDysto

  21. dukenv0307 commented on Jan 29, 2025

    @dukenv0307
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production
    • 2b. Reported on staging (deploy blocker)
    • 2c. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    Regression Test Proposal Template
    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Test:

    Set up before executing test 1, and 2

    1. Go to staging.new.expensify.com
    2. Create a workspace
    3. Go to workspace settings > Report fields (enable in More features).
    4. Add a list type report field, with some list values and an initial value.
    5. Go to the workspace chat
    6. Create an expense

    Test 1

    1. Go to the workspace chat
    2. Click on the iou preview
    3. Click on List fields
    4. Click on the already selected value
    5. Verify that there is NO Report_SetFields API call in Dev tools > Networks tab
    6. Navigate to another chat
    7. Navigate back to the expense report details page
    8. Verify that there is no system message for selecting the same report field value

    Test 2

    1. Go to the workspace chat
    2. Click on the iou preview
    3. Click on List fields
    4. Select another list field value
    5. Verify that there is Report_SetFields API call in Dev tools > Networks tab
    6. Navigate to another chat
    7. Navigate back to the expense report details page
    8. Verify that there is a system message with a format changed list fields from A to B or changed list fields to C

    Do we agree 👍 or 👎

  22. dukenv0307 commented on Jan 29, 2025

    @dukenv0307
    Contributor

    @bfitzexpensify I completed the BZ. Thank for bumping me

  23. bfitzexpensify commented on Jan 29, 2025

    @bfitzexpensify
    Contributor

    Thanks. Proposed the regression test steps, and finalised payment.

  24. moved this from Hold for Payment to Done in #expensify-bugson Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyDesignExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions