fix: maintain uid parameter in BookingDetailsSheet URL (#27872)

* fix: maintain uid parameter in BookingDetailsSheet URL

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: [email protected] <[email protected]>

* Update apps/web/playwright/bookings-list.e2e.ts

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

* fix: clean up bookings-v3 feature flag after E2E test

Co-Authored-By: [email protected] <[email protected]>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-02-12 10:39:08 +05:30
1 parent 0d55939d13
commit c7e66a3aa9
2 files changed
+51 -4

No files matched your search

@@ -185,11 +185,8 @@ function useBiDirectionalSyncBetweenStoreAndUrl({ store }: { store: BookingDetai
// Sync Store → URL
useEffect(() => {
// We can't sync from Store to URL if URL hasn't first been synced to Store
// This is to prevent override of any user configuration provided by URL query params. Think about page being refreshed
if (!isSyncedFromUrlToStoreRef.current) return;
const unsubscribe = store.subscribe((state) => {
if (!isSyncedFromUrlToStoreRef.current) return;
if (state.selectedBookingUid !== selectedBookingUidFromUrl) {
setSelectedBookingUidToUrl(state.selectedBookingUid);
}