Skip to content

feat: re-render bookings page after feature opt-in without full refresh#27873

Merged
dhairyashiil merged 2 commits intomainfrom
devin/1770821042-feature-opt-in-rerender
Feb 12, 2026
Merged

feat: re-render bookings page after feature opt-in without full refresh#27873
dhairyashiil merged 2 commits intomainfrom
devin/1770821042-feature-opt-in-rerender

Conversation

@eunjae-lee
Copy link
Copy Markdown
Contributor

@eunjae-lee eunjae-lee commented Feb 11, 2026

What does this PR do?

After a user opts into a feature via the useFeatureOptInBanner() banner on /bookings, the page now re-renders to apply the feature immediately — without a full browser reload.

Problem: bookingsV3Enabled is computed server-side in the page component and passed as a prop. When a user opts in via the banner, only the banner's local state updates (hiding it), but the server-computed prop remains stale until a manual page refresh.

Solution: Adds a required onOptInSuccess callback to useFeatureOptInBanner(). In the bookings view, this callback calls router.refresh() — the idiomatic Next.js App Router method that re-runs the server component and streams updated props to the client without losing client-side state.

This pattern is already established in the codebase (e.g., PbacOptInModal, RoleSheet).

Updates since last revision

  • Changed onOptInSuccess from optional to required per reviewer feedback, ensuring every consumer explicitly handles the post-opt-in behavior.
  • Updated all existing tests to pass onOptInSuccess.

Demo

Screenshot.2026-02-11.at.16.12.48.mp4

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A — no docs changes needed.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Navigate to /bookings as a user eligible for the bookings-v3 feature opt-in banner.
  2. Click the banner and complete the opt-in flow.
  3. After opt-in succeeds, the page should re-render and reflect the bookings-v3 feature (e.g., calendar view toggle becomes available) without a full browser reload.
  4. Verify client-side state (scroll position, active filters) is preserved after the refresh.

Unit test: TZ=UTC yarn test apps/web/modules/feature-opt-in/hooks/useFeatureOptInBanner.test.ts

Human Review Checklist

  • Confirm that making onOptInSuccess required (rather than optional) is the desired contract — every future consumer of useFeatureOptInBanner must provide this callback
  • Consider whether other pages consuming useFeatureOptInBanner should also wire up onOptInSuccess with router.refresh()

Link to Devin run: https://app.devin.ai/sessions/8ab178f5789541b2ba241659860a09b0
Requested by: @eunjae-lee

@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
@eunjae-lee eunjae-lee marked this pull request as ready for review February 11, 2026 15:13
@graphite-app graphite-app Bot requested a review from a team February 11, 2026 15:13
@graphite-app graphite-app Bot added the core area: core, team members only label Feb 11, 2026
@dhairyashiil dhairyashiil merged commit 14563f6 into main Feb 12, 2026
91 of 92 checks passed
@dhairyashiil dhairyashiil deleted the devin/1770821042-feature-opt-in-rerender branch February 12, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consumer core area: core, team members only ready-for-e2e size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants