Skip to content

[Due for payment 2025-12-02] [$250] WS settings - Rules are not highlighted in workspace setting after enabling the More features #74387

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.2.45-0
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

Action Performed:

  1. Sign in to ND
  2. Create a workspace
  3. Open More features, toggle on Rules
  4. Observe the Rules row in the workspace settings

Expected Result:

Rules row is highlighted in the workspace settings after being enabled

Actual Result:

Rules row is not highlighted like any other feature in the workspace settings after being enabled

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6995402_1762377753774.Rules.1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021986825627306320563
  • Upwork Job ID: 1986825627306320563
  • Last Price Increase: 2025-11-07
Issue OwnerCurrent Issue Owner: @mollfpr

Activity

  1. added
    Daily
    Bug
    on Nov 5, 2025
  2. melvin-bot commented on Nov 5, 2025

    @melvin-bot

    Triggered auto assignment to @lydiabarclay (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. Eskalifer1 commented on Nov 5, 2025

    @Eskalifer1
    Contributor

    Proposal

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

    WS settings - Rules are not highlighted in workspace setting after enabling the More features

    What is the root cause of that problem?

    The problem is that pendingFields may have fields that are not included in currentFeatureStates, which may result in a situation like this one, where, when areRulesEnabled is enabled, eReceipt is also added to pendingFields, which is also added to setFeatureStates and set as setHighlightedFeature, even though it should not be in the list at all:

    useEffect(() => {
    setFeatureStates((currentFeatureStates) => {
    const newFeatureStates = {} as PolicyFeatureStates;
    let newlyEnabledFeature: PolicyFeatureName | null = null;
    (Object.keys(policy?.pendingFields ?? {}) as PolicyFeatureName[]).forEach((key) => {
    const isFeatureEnabled = isPolicyFeatureEnabled(policy, key);
    // Determine if this feature is newly enabled (wasn't enabled before but is now)
    if (isFeatureEnabled && !currentFeatureStates[key]) {
    newlyEnabledFeature = key;
    }
    newFeatureStates[key] =
    prevPendingFields?.[key] !== policy?.pendingFields?.[key] || isOffline || !policy?.pendingFields?.[key] ? isFeatureEnabled : currentFeatureStates[key];
    });
    // Only highlight the newly enabled feature
    if (newlyEnabledFeature) {
    setHighlightedFeature(newlyEnabledFeature);
    }
    return {
    ...policyFeatureStates,
    ...newFeatureStates,
    };
    });
    }, [policy, isOffline, policyFeatureStates, prevPendingFields]);

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

    Add a check to see if the key exists, and if not, do nothing:

    if (!(key in currentFeatureStates)) {
                        return;
                    }

    What alternative solutions did you explore? (Optional)

    If it is possible that two elements may appear at once after a single action, then we need to convert this from a string to an array of strings and, accordingly, all the places that currently work with it:

    const [highlightedFeature, setHighlightedFeature] = useState<string | undefined>(undefined);

    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.

  4. added
    External
    on Nov 7, 2025
  5. changed the title [-]WS settings - Rules are not highlighted in workspace setting after enabling the More features[/-] [+][$250] WS settings - Rules are not highlighted in workspace setting after enabling the More features[/+] on Nov 7, 2025
  6. melvin-bot commented on Nov 7, 2025

    @melvin-bot
  7. added
    Help Wanted
    on Nov 7, 2025
  8. melvin-bot commented on Nov 7, 2025

    @melvin-bot

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

  9. daledah commented on Nov 7, 2025

    @daledah
    Contributor

    i can't reproduce this bug

  10. lydiabarclay commented on Nov 7, 2025

    @lydiabarclay
    Contributor

    I can repro

    2025-11-07_08-42-13.mp4
  11. shubham1206agra commented on Nov 9, 2025

    @shubham1206agra
    Contributor

    @Eskalifer1's proposal looks good to me.

    🎀 👀 🎀 C+ reviewed

  12. 18 remaining items

  13. melvin-bot commented on Dec 9, 2025

    @melvin-bot

    This issue has not been updated in over 15 days. @mollfpr, @shubham1206agra, @Eskalifer1, @lydiabarclay 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!

  14. added
    Daily
    and removed on Dec 10, 2025
  15. lydiabarclay commented on Dec 12, 2025

    @lydiabarclay
    Contributor

    Still waiting on bz checklist from @shubham1206agra

  16. shubham1206agra commented on Dec 15, 2025

    @shubham1206agra
    Contributor

    BugZero Checklist:

    • [Contributor] 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: https://github.com/Expensify/App/pull/40650/changes#r2618358361

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/579448

    Regression Test Proposal

    Test:

    1. Create a workspace
    2. Open More features, toggle on Rules
    3. Observe the Rules row in the workspace settings
    4. Make sure the rules row is highlighted in the workspace settings after being enabled.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-8e49-a05d-743e-339a33584984
  17. added
    Daily
    and removed
    Daily
    on Dec 15, 2025
  18. garrettmknight commented on Apr 2, 2026

    @garrettmknight
    Contributor

    $250 approved for @shubham1206agra

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