Skip to content

26W5 - Subscription - "Auto-renew" is enabled by default #81023

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: v9.3.11-15
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/test-runs/TR-3932/folder/13176687/41236709/1159241277?sort=-status_id
Email or phone of affected tester (no customers): gocemate+b21549004a@gmail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 10/Chrome
App Component: Other

Action Performed:

  1. Sign in with an existing account which has workspace created before April 1, 2025
  2. Click Account > Subscription
  3. Click the "Subscription settings"
  4. Verify "Annual subscription" is selected by default
  5. Check "Auto-renew" section
    Verify toggle switch for "Auto-renew" and its disabled by default

Expected Result:

"Auto-renew" option should be disabled by default

Actual Result:

"Auto-renew" is enabled by default

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7062053_1769788744559.Recording__187.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @joekaufmanexpensify

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 30, 2026
  2. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 30, 2026
  3. melvin-bot commented on Jan 30, 2026

    @melvin-bot

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

  4. melvin-bot commented on Jan 30, 2026

    @melvin-bot

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

  5. MobileMage commented on Jan 30, 2026

    @MobileMage
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2026-01-30 16:37:52 UTC.

    Proposal

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

    When a user signs into an existing account that has a workspace created before April 1, 2025, navigates to Account > Subscription > Subscription settings, the "Auto-renew" toggle appears enabled by default. The expected behavior according to the regression test is that the toggle should be disabled by default.

    What is the root cause of that problem?

    The root cause is in the usePrivateSubscription hook, which applies a fallback value of true when the backend does not include the autoRenew field in the NVP_PRIVATE_SUBSCRIPTION data. For pre-April 2025 accounts, the backend does not return an explicit autoRenew value in the subscription payload, so the field arrives as undefined. The hook then applies the ?? true nullish coalescing, which forces the toggle to display as enabled even though the user never opted in to auto-renewal.

    return privateSubscription
    ? {
    ...privateSubscription,
    autoRenew: privateSubscription.autoRenew ?? true,
    }

    This hook is consumed in the SubscriptionSettings page where it directly drives the toggle's isActive prop, causing the toggle to appear enabled.

    isActive={privateSubscription?.autoRenew}

    It is also consumed in SubscriptionPlanCardActionButton where it determines the auto-renew display text in the subscription summary.

    const autoRenew = privateSubscription?.autoRenew ? translate('subscription.subscriptionSettings.on') : translate('subscription.subscriptionSettings.off');

    The ?? true default was introduced in PR #67473 (merged via commit c2ea489082e) to fix issue #66168, where the auto-renew toggle appeared disabled for newly upgraded Control plan accounts. At that time, a backend engineer confirmed that the backend treats a missing autoRenew key as enabled. However, the regression test for the current issue specifically expects the toggle to be disabled by default for pre-existing accounts, indicating the expected behavior has since been updated so that auto-renew should not appear enabled unless the backend explicitly sends autoRenew: true.

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

    We should change the fallback value in the usePrivateSubscription hook from true to false. This is a single-character change in one file. When the backend explicitly sends autoRenew: true (for accounts that have it enabled), the ?? operator will not apply and the value will correctly remain true. When the backend does not include the field (for pre-April 2025 accounts that never explicitly set it), the toggle will correctly display as disabled.

    autoRenew: privateSubscription.autoRenew ?? true,

    The line should change from autoRenew: privateSubscription.autoRenew ?? true to autoRenew: privateSubscription.autoRenew ?? false. This is the minimal fix because the usePrivateSubscription hook is already the centralized place where all subscription consumers get the autoRenew value, so changing it here automatically fixes every downstream consumer (the toggle in SubscriptionSettings, the summary text in SubscriptionPlanCardActionButton, and any other current or future consumers of the hook).

    What alternative solutions did you explore? (Optional)

    N/A

  6. yatin-italy commented on Jan 30, 2026

    @yatin-italy

    Proposal

    Restate the problem this issue is trying to solve.

    The Auto-renew toggle in Subscription settings shows as enabled by default for accounts where the workspace was created before 2025-04-01. This is wrong. The toggle should be disabled by default when there is no autoRenew value from the server.

    What is the root cause of that problem?

    The earliest wrong assumption is in src/hooks/usePrivateSubscription.ts inside the usePrivateSubscription hook, where missing autoRenew is forced to true. The code assumes that if autoRenew is undefined, it should default to enabled. This is wrong because older accounts do not have this field, and treating missing data as true directly causes the UI to render the toggle as enabled.

    File: src/hooks/usePrivateSubscription.ts
    Function: usePrivateSubscription
    Lines 12-16:

    return privateSubscription
        ? {
              ...privateSubscription,
              autoRenew: privateSubscription.autoRenew ?? true,
          }
        : undefined;
    

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

    Make a defensive default at the render site so a missing autoRenew shows as disabled.

    Apply a one-line change in the settings UI.

    File: src/pages/settings/Subscription/SubscriptionSettings/index.tsx
    Current code (Lines 232-239):

    <OfflineWithFeedback pendingAction={privateSubscription?.pendingFields?.autoRenew}>
        <View style={styles.mt5}>
            <ToggleSettingOptionRow
                title={translate('subscription.subscriptionSettings.autoRenew')}
                switchAccessibilityLabel={translate('subscription.subscriptionSettings.autoRenew')}
                onToggle={handleAutoRenewToggle}
                isActive={privateSubscription?.autoRenew}
            />
    

    Change to:

    isActive={privateSubscription?.autoRenew ?? false}
    

    This matches the existing pattern used for other toggles in the same file.

    What alternative solutions did you explore? (Optional)

    Changing the default in src/hooks/usePrivateSubscription.ts was considered but not chosen because it affects shared data logic and increases risk. The UI-level default is smaller and safer.

  7. cosmicvulpes commented on Jan 30, 2026

    @cosmicvulpes
    Contributor

    Proposal

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

    When a user signs in with an existing account that has a workspace created before April 1, 2025, and navigates to Account > Subscription > Subscription settings, the "Auto-renew" toggle is enabled by default. According to the regression test, the expected behavior is that the toggle should be disabled by default for such accounts.

    What is the root cause of that problem?

    The root cause is in the usePrivateSubscription hook, which applies a fallback value of true when the backend does not include the autoRenew field in the NVP_PRIVATE_SUBSCRIPTION data.

    https://github.com/Expensify/App/blob/eb7deee963f1084ff0a950d0b1a93d4a423edd21/src/hooks/usePrivateSubscription.ts#L12-L17

    For pre-April 2025 accounts, the backend does not return an explicit autoRenew value in the subscription payload, so the field arrives as undefined. The hook then applies the ?? true nullish coalescing fallback, which forces the toggle to display as enabled even though the user never explicitly opted in to auto-renewal.

    This hook is consumed in SubscriptionSettings where the autoRenew value directly drives the toggle's isActive prop:

    https://github.com/Expensify/App/blob/eb7deee963f1084ff0a950d0b1a93d4a423edd21/src/pages/settings/Subscription/SubscriptionSettings/index.tsx#L239

    It is also consumed in SubscriptionPlanCardActionButton where it determines the auto-renew display text:

    https://github.com/Expensify/App/blob/eb7deee963f1084ff0a950d0b1a93d4a423edd21/src/pages/settings/Subscription/SubscriptionPlan/SubscriptionPlanCardActionButton.tsx#L138

    The ?? true default was introduced in PR #67473 (commit c2ea489082e) to fix issue #66168, where the auto-renew toggle appeared disabled for newly upgraded Control plan accounts. At that time, the expectation was that auto-renew should default to enabled. However, the current regression test specifically expects the toggle to be disabled by default for pre-existing accounts (workspaces created before April 1, 2025), indicating the expected behavior has changed.

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

    Change the fallback value in the usePrivateSubscription hook from true to false:

    autoRenew: privateSubscription.autoRenew ?? false,

    This is a single-character change in src/hooks/usePrivateSubscription.ts at line 15. When the backend explicitly sends autoRenew: true, the ?? operator will not apply and the value will correctly remain true. When the backend does not include the field (for pre-April 2025 accounts that never explicitly set it), the toggle will correctly display as disabled.

    This is the minimal and correct fix because the usePrivateSubscription hook is the centralized place where all subscription consumers get the autoRenew value, so changing it here automatically fixes every downstream consumer (the toggle in SubscriptionSettings, the summary text in SubscriptionPlanCardActionButton, and any other current or future consumers).

    What alternative solutions did you explore? (Optional)

    N/A

  8. joekaufmanexpensify commented on Jan 30, 2026

    @joekaufmanexpensify
    Contributor

    @lanitochka17 could you share where this test originated from, ie what prompted it to be added to browserstack? It seems like it was added recently. The expected behavior doesn't seem correct to me, so I am interested to understand more about where it originated.

  9. PiyushChandra17 commented on Jan 31, 2026

    @PiyushChandra17
    Contributor

    Proposal

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

    26W5 - Subscription - "Auto-renew" is enabled by default

    What is the root cause of that problem?

    The root cause is that by default, we are setting the autoRenew to true here

    autoRenew: privateSubscription.autoRenew ?? true,

    isActive={privateSubscription?.autoRenew}

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

    • Set this autoRenew here to false

    return privateSubscription
    ? {
    ...privateSubscription,
    autoRenew: privateSubscription.autoRenew ?? true,
    }
    : undefined;

    autoRenew: privateSubscription.autoRenew ?? false

    What alternative solutions did you explore? (Optional)

    Result:

    Image

    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.

  10. github-actions commented on Jan 31, 2026

    @github-actions
    Contributor

    ⚠️ @PiyushChandra17 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  11. joekaufmanexpensify commented on Feb 2, 2026

    @joekaufmanexpensify
    Contributor

    could you share where this test originated from, ie what prompted it to be added to browserstack? It seems like it was added recently. The expected behavior doesn't seem correct to me, so I am interested to understand more about where it originated.

    bump on this @lanitochka17

  12. m-natarajan commented on Feb 3, 2026

    @m-natarajan

    @joekaufmanexpensify This test case was created based on this issue. It looks like some steps may have been overlooked. Sorry about it. Should I update the steps to verify that the toggle works?

  13. joekaufmanexpensify commented on Feb 3, 2026

    @joekaufmanexpensify
    Contributor

    @m-natarajan Got it. Yes, for control workspaces, the auto-renew toggle should be enabled by default. That is how it works now, and to my understanding, how it has always worked/how we want it to work. If there is any test that contradicts that, it would be great if you could please update it. New collect workspaces don't have annual plans, so it is expected that there is no toggle for them.

    Please let me know once you've updated that and I'll close this issue.

  14. m-natarajan commented on Feb 3, 2026

    @m-natarajan

    @joekaufmanexpensify Updated the referenced test case, Thanks for the detailed info.

  15. joekaufmanexpensify commented on Feb 4, 2026

    @joekaufmanexpensify
    Contributor

    @m-natarajan TY! Can you also update the test to clarify that we don't show this toggle for collect plans? Your update is correct that we don't show it when pay per use is selected with control, but we also don't show it for collect.

  16. m-natarajan commented on Feb 4, 2026

    @m-natarajan

    @joekaufmanexpensify To confirm I don't see Subscription settings for new collect plan, Should I update test case to Verify No subscription settings for new collect plan. I can update this test case for this

    Image
  17. joekaufmanexpensify commented on Feb 5, 2026

    @joekaufmanexpensify
    Contributor

    Yes please! Please let me know once that's done and I'll close this out.

  18. m-natarajan commented on Feb 5, 2026

    @m-natarajan

    @joekaufmanexpensify Updated the test case, You can close this issue.

  19. joekaufmanexpensify commented on Feb 5, 2026

    @joekaufmanexpensify
    Contributor

    TY!

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions