Skip to content

Report fields and values don't get updated in Report if admin deletes them from workspace #48827

Closed

Description

@carlosmiceli

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.30-19
**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:

Action Performed:

  • Logged into NewDot as the admin of a workspace in one window and a member in another.
  • Go to workspace settings as admin.
  • Go to the report fields section.
  • Make sure there are list values on the workspace report fields.
  • As a member, open an expense's report fields.
  • As an admin, delete all of the values.

Expected Result:

Report should update to show that fields were updated/deleted.

Actual Result:

Nothing changes in the member report, despite fields and values having changed for the workspace.

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

repot.fields.error.mov

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @aimane-chnaif

Activity

  1. added
    External
    Daily
    Bug
    on Sep 9, 2024
  2. self-assigned this
    on Sep 9, 2024
  3. added
    Help Wanted
    on Sep 9, 2024
  4. melvin-bot commented on Sep 9, 2024

    @melvin-bot

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

  5. melvin-bot commented on Sep 9, 2024

    @melvin-bot

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

  6. FitseTLT commented on Sep 9, 2024

    @FitseTLT
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-09-09 22:04:40 UTC.

    Proposal

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

    Report fields and values don't get updated in Report if admin deletes them from workspace

    What is the root cause of that problem?

    We are using report Fields list here instead of policy field list

    const reportField = report?.fieldList?.[fieldKey] ?? policy?.fieldList?.[fieldKey];

    fieldOptions={reportField.values.filter((_value: string, index: number) => !reportField.disabledOptions[index])}

    but when report fields are updated it is the policy fields lists that gets updated

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

    We should use policy fields for options

        const policyField = policy?.fieldList?.[fieldKey] ?? reportField;
    
    
    
                        fieldOptions={policyField.values.filter((_value: string, index: number) => !policyField.disabledOptions[index])}
    
    

    we can also consider updating the report fields values and other props as disabledOpitons to the policy field values on updateReportField

    What alternative solutions did you explore? (Optional)

    But we can also consider some more props other than values to be taken from policy field instead of report fields such as deletable defaultValue etc

  7. cretadn22 commented on Sep 10, 2024

    @cretadn22
    Contributor

    Proposal

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

    Report fields and values don't get updated in Report if admin deletes them from workspace

    What is the root cause of that problem?

    When updating the report field, we only modify policy.reportField. However, on the EditReportFieldPage, we prioritize using report.reportField, which remains unchanged.

    const reportField = report?.fieldList?.[fieldKey] ?? policy?.fieldList?.[fieldKey];

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

    const reportField = report?.fieldList?.[fieldKey] ?? policy?.fieldList?.[fieldKey];

    Update to const reportField = policy?.fieldList?.[fieldKey] ?? report?.fieldList?.[fieldKey]; Or creating new variable to avoid affecting other features

    Additionally, we only show the search bar when the list is empty.

    9

    We should display the empty view with the Edit button only for admins, similar to how we implemented it on the category page

    {shouldShowEmptyState && (
    <View style={[styles.flex1]}>
    <WorkspaceEmptyStateSection
    shouldStyleAsCard={false}
    icon={Illustrations.EmptyStateExpenses}
    title={translate('workspace.categories.emptyCategories.title')}
    subtitle={translate('workspace.categories.emptyCategories.subtitle')}
    containerStyle={[styles.flex1, styles.justifyContentCenter]}
    />
    {PolicyUtils.isPolicyAdmin(policy) && (
    <FixedFooter style={[styles.mtAuto, styles.pt5]}>
    <Button
    large
    success
    style={[styles.w100]}
    onPress={() =>
    Navigation.navigate(
    ROUTES.SETTINGS_CATEGORIES_ROOT.getRoute(
    policy?.id ?? '-1',
    ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(action, iouType, transactionID, report?.reportID ?? '-1', backTo, reportActionID),
    ),
    )
    }
    text={translate('workspace.categories.editCategories')}
    pressOnEnter
    />
    </FixedFooter>
    )}
    </View>

    What alternative solutions did you explore? (Optional)

  8. FitseTLT commented on Sep 10, 2024

    @FitseTLT
    Contributor

    Sorry forgot to notify Updated

    But note that my last update was hours before the other proposals above

  9. aimane-chnaif commented on Sep 10, 2024

    @aimane-chnaif
    Contributor

    @FitseTLT's proposal looks good.
    🎀👀🎀 C+ reviewed

  10. melvin-bot commented on Sep 10, 2024

    @melvin-bot

    Current assignees @puneetlath and @carlosmiceli are eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

  11. removed
    Help Wanted
    on Sep 10, 2024
  12. 1 remaining item

  13. added
    Weekly
    and removed
    Daily
    on Sep 11, 2024
  14. FitseTLT commented on Oct 3, 2024

    @FitseTLT
    Contributor

    @puneetlath payment overdue

  15. added and removed
    Weekly
    on Oct 7, 2024
  16. melvin-bot commented on Oct 7, 2024

    @melvin-bot

    This issue has not been updated in over 15 days. @carlosmiceli, @puneetlath, @FitseTLT, @aimane-chnaif eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  17. FitseTLT commented on Oct 7, 2024

    @FitseTLT
    Contributor

    @puneetlath can u pls issue the payment here? Thx!

  18. puneetlath commented on Oct 9, 2024

    @puneetlath
    Contributor

    Hm, seems there is no upwork job.

    @FitseTLT offer here: https://www.upwork.com/nx/wm/offer/104341899
    @aimane-chnaif offer here: https://www.upwork.com/nx/wm/offer/104341902

    @aimane-chnaif can you please complete the checklist?

  19. FitseTLT commented on Oct 9, 2024

    @FitseTLT
    Contributor

    @puneetlath offer accepted!

  20. puneetlath commented on Oct 9, 2024

    @puneetlath
    Contributor

    @FitseTLT has been paid. Just waiting on @aimane-chnaif.

  21. aimane-chnaif commented on Oct 15, 2024

    @aimane-chnaif
    Contributor

    Offending PR with comment: #36553 (comment)

    Regression Test Proposal

    1. Log in as the admin of a workspace in one window and a member in another.
    2. Go to workspace settings as admin.
    3. Go to the report fields section.
    4. Make sure there are list values on the workspace report fields.
    5. As a member, open an expense's report fields.
    6. As an admin, delete some values.
    7. Verify that report fields are deleted accordingly on member side.
  22. puneetlath commented on Oct 16, 2024

    @puneetlath
    Contributor
  23. aimane-chnaif commented on Oct 23, 2024

    @aimane-chnaif
    Contributor

    Accepted thanks

  24. puneetlath commented on Oct 23, 2024

    @puneetlath
    Contributor

    Paid!

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

Metadata

Metadata

Labels

BugExternalMonthlyReviewing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions