Skip to content

[Due for payment 2026-05-28] [$250] Home - No expected banner shown after running a snippet #88447

Closed

Description

@jponikarchuk

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.3.61-0
Reproducible in staging?: Yes
Reproducible in production?: Unable to validate in Prod - Provide reasoning.
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/folder/40579099/test-cases/88870317
Email or phone of affected tester (no customers): -
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Ventura / Chrome
App Component: Other

Action Performed:

Precondition:

  1. Login with a new account and create a Collect workspace.
  2. Ensure no billing card is on file.
  3. Navigate to Account > Subscription
  4. Run the snippet to set nvp_private_firstDayFreeTrial to today's date (May require page refresh):
    Onyx.set('nvp_private_firstDayFreeTrial', '2026-04-21T09:00:00');

STR:

  1. Navigate to the Home page
  2. "Time sensitive" section appears at the top of the left column

Expected Result:

Verify the item displays a stopwatch icon
Verify the title is "50% off your first year"
Verify the supporting text shows a live countdown: "{HH}h {MM}m {SS}sec remaining"

Actual Result:

No expencted format banner.
Something like 'Trial: 30 days left!' only.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Video.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022046615970624008812
  • Upwork Job ID: 2046615970624008812
  • Last Price Increase: 2026-04-28
  • Automatic offers:
    • thelullabyy | Reviewer | 111332017

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Apr 21, 2026
  2. MelvinBot commented on Apr 21, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The "50% off your first year" discount banner with the live countdown is intentionally suppressed for Collect (Team) workspace users with 2025 pricing by an explicit guard in shouldShowDiscountBanner:

    if (hasTeam2025Pricing && subscriptionPlan === CONST.POLICY.TYPE.TEAM) {
        return false;
    }
    

    When a new user creates a Collect workspace in 2026:

    1. useHasTeam2025Pricing returns true (user created after April 1, 2025 or has no firstPolicyDate)
    2. useSubscriptionPlan returns TEAM (Collect = Team type, no Corporate workspace)
    3. shouldShowDiscountBanner → false, so discountType becomes null in useFreeTrial

    As a result, FreeTrialSection renders in fallback mode — showing "Free trial: N days left!" with "Don't wait! Add your payment card now." instead of the discount offer + countdown. The "Trial: 30 days left!" text the reporter sees is from the separate FreeTrial badge in the inbox header, which is unrelated to the Home page widget.

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

    Remove the Team 2025 pricing exclusion at SubscriptionUtils.ts:168-170 so the discount banner shows for all free trial users regardless of pricing tier, or update it to only suppress the discount for a specific scenario if there's a business reason for the exclusion.

    Since this was caught by a regression test that explicitly expects the discount banner for Collect workspace users, removing the guard seems like the correct fix. The FreeTrialSection widget and countdown logic already work correctly — they're just being gated off.

    What alternative solutions did you explore? (Optional)

    An alternative would be to keep the exclusion but create a separate Team-2025-specific banner variant in FreeTrialSection. However, the simpler approach of removing the guard is preferable unless there's a deliberate business reason to suppress discounts for Team 2025 pricing users.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 21, 2026
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 21, 2026
  5. melvin-bot commented on Apr 21, 2026

    @melvin-bot

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

  6. changed the title [-]Home - No expected banner shown after running a snippet[/-] [+][$250] Home - No expected banner shown after running a snippet[/+] on Apr 21, 2026
  7. melvin-bot commented on Apr 21, 2026

    @melvin-bot
  8. MobileMage commented on Apr 21, 2026

    @MobileMage
    Contributor

    Proposal

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

    After running an Onyx snippet to set nvp_private_firstDayFreeTrial on an already-mounted Home page, the expected "50% off your first year" discount banner with a live countdown does not appear — instead the generic "Trial: 30 days left!" text is shown.

    What is the root cause of that problem?

    The useFreeTrial hook initializes discountInfo via a useState lazy initializer that only runs once on mount. When firstDayFreeTrial is set via the snippet after the component is already mounted, showDiscount becomes true and the useEffect re-runs. However, the effect's cleanup from the previous render fires setDiscountInfo(null) before the new interval is set up, and the new interval only populates discountInfo after a full 1-second tick. During that window — and on the very first render after the Onyx value is received — discountInfo is null, so getDiscountType returns null and the component falls through to the generic "add card" path.

    The fundamental problem is that the effect never sets discountInfo immediately when it starts; it only updates on subsequent interval ticks. Combined with the cleanup unconditionally resetting discountInfo to null, there is always at least a 1-second gap where discountType is null.

    const [discountInfo, setDiscountInfo] = useState<DiscountInfo | null>(() => (showDiscount ? getEarlyDiscountInfo(firstDayFreeTrial) : null));
    useEffect(() => {
    if (!showDiscount) {
    return;
    }
    const intervalID = setInterval(() => {
    setDiscountInfo(getEarlyDiscountInfo(firstDayFreeTrial));
    }, CONST.MILLISECONDS_PER_SECOND);
    return () => {
    clearInterval(intervalID);
    setDiscountInfo(null);
    };
    }, [firstDayFreeTrial, showDiscount]);

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

    Set discountInfo immediately at the start of the effect instead of waiting for the first interval tick, and remove the cleanup's setDiscountInfo(null) call so that the existing discount info is not wiped between re-renders.

    useEffect(() => {
    if (!showDiscount) {
    return;
    }
    const intervalID = setInterval(() => {
    setDiscountInfo(getEarlyDiscountInfo(firstDayFreeTrial));
    }, CONST.MILLISECONDS_PER_SECOND);
    return () => {
    clearInterval(intervalID);
    setDiscountInfo(null);
    };
    }, [firstDayFreeTrial, showDiscount]);

         useEffect(() => {
             if (!showDiscount) {
    +            setDiscountInfo(null);
                 return;
             }
    
    +        setDiscountInfo(getEarlyDiscountInfo(firstDayFreeTrial));
    +
             const intervalID = setInterval(() => {
                 setDiscountInfo(getEarlyDiscountInfo(firstDayFreeTrial));
             }, CONST.MILLISECONDS_PER_SECOND);
    
             return () => {
                 clearInterval(intervalID);
    -            setDiscountInfo(null);
             };
         }, [firstDayFreeTrial, showDiscount]);

    The setDiscountInfo(null) is moved into the !showDiscount branch so it still clears when the discount is no longer applicable, while the immediate setDiscountInfo call ensures the correct discount info is available on the very first render after firstDayFreeTrial is set.

    What alternative solutions did you explore? (Optional)

    N/A

  9. alexanderxfgl-bit commented on Apr 21, 2026

    @alexanderxfgl-bit

    Proposal

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

    The home page is not displaying the expected "50% off your first year" banner after running a snippet to set the nvp_private_firstDayFreeTrial Onyx key. Instead, it's showing a generic "Trial: 30 days left!" banner.

    What is the root cause of that problem?

    The useTimeSensitiveBilling hook (src/pages/home/TimeSensitiveSection/hooks/useTimeSensitiveBilling.ts, line 13) is responsible for determining which banner to display. Currently, it only checks for billing errors and doesn't consider the nvp_private_firstDayFreeTrial key, which is used to trigger the free trial banner. This causes the component to fall back to the default trial banner.

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

    Modify the useTimeSensitiveBilling hook to check the nvp_private_firstDayFreeTrial Onyx key and return a boolean value indicating whether the free trial banner should be displayed. This will allow the component to correctly render the "50% off your first year" banner when the condition is met.

    What alternative solutions did you explore? (Optional)

    N/A

  10. alexanderxfgl-bit commented on Apr 21, 2026

    @alexanderxfgl-bit

    Contributor details
    Your Expensify account email: alexanderxfgl@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~2021935202864784599

  11. melvin-bot commented on Apr 21, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  12. 57 remaining items

  13. thelullabyy commented on May 28, 2026

    @thelullabyy
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to the comment on the PR: N/A
      Link to the comment on the Issue: N/A

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

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

    Test:

    1. Go to Home → paste in console:
    Onyx.set('nvp_private_firstPolicyCreatedDate', '2025-01-01');
    Onyx.set('nvp_private_manualTeam2025Pricing', null);
    Onyx.set('nvp_private_firstDayFreeTrial', new Date().toISOString().slice(0, 19));
    const l = new Date(); l.setDate(l.getDate() + 30);
    Onyx.set('nvp_private_lastDayFreeTrial', l.toISOString().slice(0, 19));
    Onyx.set('nvp_private_billingFundID', null);
    
    1. Verify that Right column: Free trial: 30 days left! | body Get 50% off your first year (no ! on body) | Time remaining: 23h : 59m : XXs (ticking) | green Claim.

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-f054-a1b1-37b6-eb9f242bb3a4
  14. mallenexpensify commented on May 29, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @abbasifaizan70 paid $250 via Upwork
    Contributor+: @thelullabyy paid $250 via Upwork

    @abbasifaizan70 can you please accept the job below? Please reply here and tag me once you have.
    If you're not sent an offer in Upwork when you're assigned to an issue, and an Upwork job exists, please submit a proposal.
    https://www.upwork.com/jobs/~022046615970624008812

    ^ Test case created. Thx

  15. melvin-bot commented on Jun 1, 2026

    @melvin-bot

    @mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  16. melvin-bot commented on Jun 5, 2026

    @melvin-bot

    @mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

  17. abbasifaizan70 commented on Jun 5, 2026

    @abbasifaizan70
    Contributor

    @mallenexpensify, Offer accepted and waiting for your approval. Thank

  18. mallenexpensify commented on Jun 6, 2026

    @mallenexpensify
    Contributor

    @abbasifaizan70 paid, summary updated above. Thx.

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