Skip to content

[Due for payment 2025-11-14] [$250] Workspace - Receipt partners menu appears in the WS editor without animation after enabling #73799

Closed

Description

@mitarachim

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.2.40-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/folder/13177080/test-cases/41237925?p=2
Email or phone of affected tester (no customers): n/a
Issue reported by: Applause Internal Team
Device used: Mac 15.4.1 Safari, Desktop, iPhone 13 iOS 18.6.2 Safari, Hybrid
App Component: Workspace Settings

Action Performed:

  1. Navigate to https://staging.new.expensify.com
  2. Login with an Expensifail account
  3. Create a new workspace
  4. Go to More Features
  5. Enable the Receipt partners toggle

Expected Result:

Receipt partners menu item appears with animation in the workspace editor after enabling

Actual Result:

Receipt partners menu appears without animation in the WS editor after enabling

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6988495_1761776569972.Recording__867.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021985332153316064306
  • Upwork Job ID: 1985332153316064306
  • Last Price Increase: 2025-11-03
Issue OwnerCurrent Issue Owner: @greg-schroeder

Activity

  1. added
    Daily
    Bug
    on Oct 30, 2025
  2. melvin-bot commented on Oct 30, 2025

    @melvin-bot

    Triggered auto assignment to @greg-schroeder (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. ryntgh commented on Oct 30, 2025

    @ryntgh
    Contributor

    Proposal

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

    Workspace - Receipt partners menu appears in the WS editor without animation after enabling

    What is the root cause of that problem?

    The current animation detection only monitors top-level policy.pendingFields for detecting newly enabled features, but Receipt Partners uses a nested pending field structure at policy.receiptPartners.pendingFields.enabled

    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]);

    It only iterates through policy?.pendingFields keys, but Receipt Partners sets its pending state in a nested structure on enablePolicyReceiptPartners

    value: {
    receiptPartners: {
    enabled,
    pendingFields: {
    enabled: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
    },
    },
    },

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

    Add special handling for Receipt Partners in the feature state update logic

        const prevReceiptPartnersPendingFields = usePrevious(policy?.receiptPartners?.pendingFields);
        ...
        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];
                });
    
                // Special handling for Receipt Partners since it uses nested pending fields
                const receiptPartnersKey = CONST.POLICY.MORE_FEATURES.ARE_RECEIPT_PARTNERS_ENABLED;
                const isReceiptPartnersEnabled = isPolicyFeatureEnabled(policy, receiptPartnersKey);
                const prevReceiptPartnersPending = prevReceiptPartnersPendingFields?.enabled;
                const currentReceiptPartnersPending = policy?.receiptPartners?.pendingFields?.enabled;
                if (isReceiptPartnersEnabled && !currentFeatureStates[receiptPartnersKey] && prevReceiptPartnersPending !== currentReceiptPartnersPending) {
                    newlyEnabledFeature = receiptPartnersKey;
                }
                newFeatureStates[receiptPartnersKey] =
                    prevReceiptPartnersPending !== currentReceiptPartnersPending || isOffline || !currentReceiptPartnersPending
                        ? isReceiptPartnersEnabled
                        : currentFeatureStates[receiptPartnersKey];
    
                // Only highlight the newly enabled feature
                if (newlyEnabledFeature) {
                    setHighlightedFeature(newlyEnabledFeature);
                }
    
                return {
                    ...policyFeatureStates,
                    ...newFeatureStates,
                };
            });
        }, [policy, isOffline, policyFeatureStates, prevPendingFields, prevReceiptPartnersPendingFields]);

    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 alternative solutions did you explore? (Optional)

    N/A

  4. bernhardoj commented on Oct 30, 2025

    @bernhardoj
    Contributor

    Proposal

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

    The receipt partner feature is not animated when enabled.

    What is the root cause of that problem?

    The feature will be highlighted if it's detected as a newly enabled feature.

    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);
    }

    It iterates over the policy pendingFields keys and checks if the feature is already present or not. If not, then it will be set as the highlighted feature (setHighlightedFeature).

    However, when we enable the feature, we don't set the policy pendingFields. Instead, we set the pending fields inside the feature object itself.

    key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
    value: {
    receiptPartners: {
    enabled,
    pendingFields: {
    enabled: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
    },
    },
    },

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

    We need to set the pending fields on the root policy object.

    key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
    value: {
    receiptPartners: {
    enabled,
    pendingFields: {
    enabled: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
    },
    },
    },

    value: {
        receiptPartners: {enabled},
        pendingFields: {
            receiptPartners: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
        },
    },
    

    (adjust the success and failure data)

    Then, update the pending fields usage here too.

    pendingAction: policy?.receiptPartners?.pendingFields?.enabled,

    pendingAction: policy?.pendingFields?.receiptPartners,
    
  5. added
    External
    on Nov 3, 2025
  6. changed the title [-]Workspace - Receipt partners menu appears in the WS editor without animation after enabling[/-] [+][$250] Workspace - Receipt partners menu appears in the WS editor without animation after enabling[/+] on Nov 3, 2025
  7. melvin-bot commented on Nov 3, 2025

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

    @melvin-bot

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

  10. eh2077 commented on Nov 5, 2025

    @eh2077
    Contributor

    I think @bernhardoj 's proposal is right to go with - adding missing pending fields instead of twisting the useEffect of animation.

    🎀👀🎀 C+ reviewed

  11. 12 remaining items

  12. removed
    Reviewing
    on Nov 7, 2025
  13. melvin-bot commented on Nov 7, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  14. melvin-bot commented on Nov 7, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.2.46-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-11-14. 🎊

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

    • @bernhardoj requires payment through NewDot Manual Requests
    • @eh2077 requires payment through NewDot Manual Requests
  15. melvin-bot commented on Nov 7, 2025

    @melvin-bot

    @bernhardoj / @eh2077 @greg-schroeder 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. added
    Daily
    and removed
    Weekly
    on Nov 14, 2025
  17. melvin-bot commented on Nov 14, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@greg-schroeder)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1985332153316064306/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  18. eh2077 commented on Nov 17, 2025

    @eh2077
    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/70588/files#r2532481152

    • [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:

    Regression Test Proposal

    Precondition:

    • go offline

    Test:

    1. Open workspace More Features page
    2. Enable Receipt partner
    3. Verify the Receipt partner menu item is animated
    4. Verify the Receipt partner in More features is grayed out

    Do we agree 👍 or 👎

  19. greg-schroeder commented on Nov 18, 2025

    @greg-schroeder
    Contributor

    Payment summary:

    Author: @bernhardoj - $250 - ND
    Reviewer: @eh2077 - $250 - ND

    Approved for payments as outlined above ☝️

  20. bernhardoj commented on Nov 18, 2025

    @bernhardoj
    Contributor

    Requested in ND.

  21. garrettmknight commented on Nov 21, 2025

    @garrettmknight
    Contributor

    $250 approved for @bernhardoj

  22. garrettmknight commented on Dec 18, 2025

    @garrettmknight
    Contributor

    $250 approved for @eh2077

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

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions