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
    BugSomething is broken. Auto assigns a BugZero manager.
    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
    ExternalAdded to denote the issue can be worked on by a contributor
    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 WantedApply this label when an issue is open to proposals by contributors
    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. lydiabarclay commented on Dec 12, 2025

    @lydiabarclay
    Contributor

    Still waiting on bz checklist from @shubham1206agra

  15. shubham1206agra commented on Dec 15, 2025

    @shubham1206agra
    Contributor

    BugZero Checklist:

    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
  16. 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 PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions