Skip to content

fix: maintain uid parameter in BookingDetailsSheet URL#27872

Merged
dhairyashiil merged 3 commits intomainfrom
devin/1770817862-fix-booking-uid-url-param
Feb 12, 2026
Merged

fix: maintain uid parameter in BookingDetailsSheet URL#27872
dhairyashiil merged 3 commits intomainfrom
devin/1770817862-fix-booking-uid-url-param

Conversation

@eunjae-lee
Copy link
Copy Markdown
Contributor

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

What does this PR do?

Fixes a regression where the &uid= query parameter stopped appearing in the URL when clicking a booking in the v3 bookings view. This was introduced in commit a7fd7890a7 which refactored the URL sync into useBiDirectionalSyncBetweenStoreAndUrl and added an isSyncedFromUrlToStoreRef guard.

Root cause: The guard if (!isSyncedFromUrlToStoreRef.current) return was placed at the effect level, causing the entire effect (including the store.subscribe() call) to be skipped on initial render when the ref is false. After the URL→Store effect sets the ref to true, the Store→URL effect never re-runs because its dependencies haven't changed. Result: the Zustand subscription that pushes selectedBookingUid changes to the URL is never created.

Fix: Move the guard from the effect level to inside the subscription callback. This ensures the subscription is always created, while still preventing premature URL overwrites during URL→Store sync on page refresh.

Also adds an E2E test that enables the bookings-v3 feature flag, clicks a booking item, and asserts the uid query parameter appears in the URL. The test properly saves and restores the feature flag state via try/finally to avoid cross-test side effects.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

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
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Enable the bookings-v3 feature flag
  2. Navigate to /bookings/upcoming
  3. Click on any booking item
  4. Verify the URL updates to include ?uid=<booking-uid>
  5. Verify the booking detail sheet opens

The E2E test (bookings-list.e2e.ts, grep for "clicking a booking item adds uid param") covers this flow automatically.

Human Review Checklist

  • Verify the moved guard (if (!isSyncedFromUrlToStoreRef.current) return now inside the subscribe callback) is logically equivalent — it still prevents Store→URL sync before URL→Store sync completes, but no longer blocks subscription creation
  • The useEffect dependency array does not include setSelectedBookingUidToUrl / setActiveSegmentToUrl — this is pre-existing and unchanged, but worth noting

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

Move the isSyncedFromUrlToStoreRef guard from the effect level to inside
the Zustand subscription callback. This ensures the Store→URL subscription
is always created while still preventing premature URL overwrites during
URL→Store sync.

Also adds an E2E test verifying the uid parameter appears in the URL
after clicking a booking item in the v3 bookings view.

Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
@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

@eunjae-lee eunjae-lee marked this pull request as ready for review February 11, 2026 14:39
@graphite-app graphite-app Bot added consumer core area: core, team members only labels Feb 11, 2026
@graphite-app graphite-app Bot requested a review from a team February 11, 2026 14:39
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.

2 issues found across 2 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/web/playwright/bookings-list.e2e.ts">

<violation number="1" location="apps/web/playwright/bookings-list.e2e.ts:773">
P1: Rule violated: **E2E Tests Best Practices**

This test mutates the `bookings-v3` feature flag without cleaning it up, violating the E2E rule to reset DB state and avoid cross-test side effects. Add a teardown (e.g., in afterEach or finally) that restores the previous flag state or deletes the created record.</violation>

<violation number="2" location="apps/web/playwright/bookings-list.e2e.ts:802">
P2: Rule violated: **E2E Tests Best Practices**

Use `expect(page).toHaveURL()` to assert the URL instead of `expect.poll`, per the E2E best practices. This ensures fast failure on unexpected redirects.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread apps/web/playwright/bookings-list.e2e.ts
Comment thread apps/web/playwright/bookings-list.e2e.ts Outdated
@eunjae-lee eunjae-lee marked this pull request as draft February 11, 2026 14:40
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 11, 2026

Devin AI is addressing Cubic AI's review feedback

New feedback has been sent to the existing Devin session.

View Devin Session

✅ Pushed commit e360528

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:09
@dhairyashiil dhairyashiil merged commit c7e66a3 into main Feb 12, 2026
84 of 85 checks passed
@dhairyashiil dhairyashiil deleted the devin/1770817862-fix-booking-uid-url-param branch February 12, 2026 05:09
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