Skip to content

[HOLD for payment 2024-08-02] [$250] Expense - Title field is not grayed out when edited offline #45072

Closed

Description

@lanitochka17

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.5-7
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Issue found when executing PR #44988

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat
  3. Submit an expense
  4. Click on the expense preview
  5. Go offline
  6. Click on the report header
  7. Click Title field
  8. Edit the title and save it

Expected Result:

The title field will be grayed out when edited offline

Actual Result:

The title field is not grayed out when edited offline

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

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

Screenshots/Videos

Add any screenshot/video evidence

Bug6536842_1720529327391.20240709_204502.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ef7d62e69d5030af
  • Upwork Job ID: 1811445257984330574
  • Last Price Increase: 2024-07-18
  • Automatic offers:
    • dominictb | Contributor | 103220965
Issue OwnerCurrent Issue Owner: @miljakljajic

Activity

  1. added
    Daily
    Bug
    on Jul 9, 2024
  2. melvin-bot commented on Jul 9, 2024

    @melvin-bot

    Triggered auto assignment to @miljakljajic (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. etCoderDysto commented on Jul 9, 2024

    @etCoderDysto
    Contributor

    Proposal

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

    Title field is not grayed out when edited offline

    What is the root cause of that problem?

    When updating title we add pending action to report.pedingFields.reportName. But
    we are passing only report.pendingFields?.[fieldKey] to pendingAction of report title here

    const nameSectionTitleField = titleField && (
    <OfflineWithFeedback
    pendingAction={report.pendingFields?.[fieldKey]}

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

    we should add report?.pendingFields?.reportName to pendingAction too

     pendingAction={report.pendingFields?.[fieldKey] ?? report?.pendingFields?.reportName}
    

    What alternative solutions did you explore? (Optional)

    Result:

    Screen.Recording.2024-07-09.at.4.29.07.in.the.afternoon.mp4
  4. Krishna2323 commented on Jul 9, 2024

    @Krishna2323
    Contributor

    Proposal

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

    Expense - Title field is not grayed out when edited offline

    What is the root cause of that problem?

    We are trying to access the report pending action using fieldKey which is incorrect.

    <OfflineWithFeedback
    pendingAction={report.pendingFields?.[fieldKey]}
    errors={report.errorFields?.[fieldKey]}
    errorRowStyles={styles.ph5}
    key={`menuItem-${fieldKey}`}
    onClose={() => Report.clearReportFieldErrors(report.reportID, titleField)}

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

    • We should simply get the pending action and error using reportName because this the key used to set the pending action and error in ONYX.
    • We also need to create a new util function to clear the errors for reportName key or we can update clearReportFieldErrors to accept a new param for fieldKey and use that instead if present. And when calling Report.clearReportNameErrors(report.reportID, titleField, 'reportName') for title we will pass fieldKey as reportName.
    • Alternatively we can accept third param reportName as boolean and use that to determine fieldKey in clearReportFieldErrors.

    App/src/libs/actions/Report.ts

    Lines 1820 to 1830 in 87fdc79

    function clearReportFieldErrors(reportID: string, reportField: PolicyReportField) {
    const fieldKey = ReportUtils.getReportFieldKey(reportField.fieldID);
    Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
    pendingFields: {
    [fieldKey]: null,
    },
    errorFields: {
    [fieldKey]: null,
    },
    });
    }

    <OfflineWithFeedback
        pendingAction={report?.pendingFields?.reportName}
        errors={report.errorFields?.reportName}
        errorRowStyles={styles.ph5}
        key={`menuItem-${fieldKey}`}
        onClose={() => Report.clearReportFieldErrors(report.reportID, titleField, true)}
    >
            
            
    function clearReportFieldErrors(reportID: string, reportField: PolicyReportField, reportName?: boolean) {
        const fieldKey = reportName ? 'reportName' : ReportUtils.getReportFieldKey(reportField.fieldID);
        Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
            pendingFields: {
                [fieldKey]: null,
            },
            errorFields: {
                [fieldKey]: null,
            },
        });
    }

    What alternative solutions did you explore? (Optional)

  5. dominictb commented on Jul 10, 2024

    @dominictb
    Contributor

    Proposal

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

    • The title field is not grayed out when edited offline

    What is the root cause of that problem?

    • We display the title field as:
      const nameSectionTitleField = titleField && (
      <OfflineWithFeedback
      pendingAction={report.pendingFields?.[fieldKey]}
      errors={report.errorFields?.[fieldKey]}

      with the pendingAction={report.pendingFields?.[fieldKey]} in this case fieldKey is text_title. But when the title field is updated, we only set:

      App/src/libs/actions/Report.ts

      Lines 1770 to 1772 in 8ee4c92

      pendingFields: {
      reportName: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
      },

      so the title field is not grayed out when edited offline.

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

    • We should get the pendingAction base on both report.pendingFields?.[fieldKey] and report.pendingFields.reportName because:
    1. report.pendingFields?.['text_title']: This data is the pending state of the report.fieldList.['text_title']. It will affect how we display the report title. If the report.fieldList.['text_title'].deletable is true, so we can display the report title as editable and vice versa. That is what we handled in the below logic:

      const shouldShowTitleField = caseID !== CASES.MONEY_REQUEST && !isFieldDisabled && ReportUtils.isAdminOwnerApproverOrReportOwner(report, policy);

      Also, in OD, we can change the report.fieldList.['text_title'] data, so I am pretty sure that we will allow users to do it in ND in the future.

    2. report.pendingFields.reportName: This data is the pending state of the report.reportName.

                pendingAction={report.pendingFields?.[fieldKey] || report.pendingFields?.reportName}
    
                onClose={() => {
                    if(report.errorFields.reportName){
                        clearReportErrors(report.reportID, 'reportName')
                    }
                    Report.clearReportFieldErrors(report.reportID, titleField)
                }}
    

    with:

     const clearReportErrors = (reportID: string, fieldKey: string)=>{
        Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
            pendingFields: {
                [fieldKey]: null,
            },
            errorFields: {
                [fieldKey]: null,
            },
        });
     }
    

    What alternative solutions did you explore? (Optional)

  6. added
    External
    on Jul 11, 2024
  7. melvin-bot commented on Jul 11, 2024

    @melvin-bot
  8. changed the title [-]Expense - Title field is not grayed out when edited offline[/-] [+][$250] Expense - Title field is not grayed out when edited offline[/+] on Jul 11, 2024
  9. added
    Help Wanted
    on Jul 11, 2024
  10. melvin-bot commented on Jul 11, 2024

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh (External)

  11. 37 remaining items

  12. melvin-bot commented on Jul 26, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.12-0 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 2024-08-02. 🎊

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

  13. melvin-bot commented on Jul 26, 2024

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@fedirjh] The PR that introduced the bug has been identified. Link to the PR:
    • [@fedirjh] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • [@fedirjh] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
    • [@fedirjh] Determine if we should create a regression test for this bug.
    • [@fedirjh] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@miljakljajic] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  14. added
    Daily
    and removed
    Weekly
    on Aug 1, 2024
  15. fedirjh commented on Aug 2, 2024

    @fedirjh
    Contributor

    BugZero Checklist:

    Regression Test Proposal

    1. Go to workspace chat
    2. Submit an expense
    3. Click on the expense preview
    4. Go offline
    5. Click on the report header
    6. Click Title field
    7. Edit the title and save it
    8. Confirm it changed it's state to reflect being changed in offline mode to be greyed out
    
    • Do we agree 👍 or 👎
  16. github-actions commented on Aug 2, 2024

    @github-actions
    Contributor

    true

  17. JmillsExpensify commented on Aug 5, 2024

    @JmillsExpensify
    Contributor

    @miljakljajic payment summary when you get a chance.

  18. miljakljajic commented on Aug 5, 2024

    @miljakljajic
    Contributor

    @fedirjh is owed 250 for their work reviewing this issue

  19. JmillsExpensify commented on Aug 5, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @fedirjh

  20. dominictb commented on Aug 6, 2024

    @dominictb
    Contributor

    @miljakljajic I'm also due payment here as the PR uses my proposal.

    @aldo-expensify Also confirmed it above.

    I've accepted the Upwork offer for the job.

  21. miljakljajic commented on Aug 7, 2024

    @miljakljajic
    Contributor

    Paid you too @dominictb , thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions