fix: prevent BookingDetailsSheet flicker when switching bookings#27894
Merged
fix: prevent BookingDetailsSheet flicker when switching bookings#27894
Conversation
Co-Authored-By: eunjae@cal.com <hey@eunjae.dev>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Devin AI is resolving merge conflictsThis PR has merge conflicts with the Devin will:
If you prefer to resolve conflicts manually, you can close the Devin session and handle it yourself. |
…licker Co-Authored-By: unknown <>
PeerRich
approved these changes
Feb 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes the BookingDetailsSheet flickering (disappearing and reappearing) when clicking a different booking while the sheet is already open.
Root causes:
selectedBookingUidupdates immediately but the new booking may not yet be in the store'sbookingsarray (due to bi-directional URL↔store sync timing), causinggetSelectedBooking()to momentarily returnnull→ sheet unmounts → remounts once data arrives.onInteractOutside. The handler only checked fordata-booking-list-item, so calendar events triggered the sheet to close and reopen.Fix:
useRefinBookingDetailsSheetto retain the last valid booking. During transitions where the new booking isn't resolved yet, the previous booking stays displayed instead of the sheet unmounting.data-booking-calendar-eventattribute to calendarEventcomponent and updateonInteractOutsideto recognize both list items and calendar events.Demo
↓ This is the flicker we were seeing on the main. Now it's gone after this PR.
Screenshot.2026-02-12.at.18.07.38.mp4
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
/bookingsBookingDetailsSheetTZ=UTC yarn vitest run apps/web/modules/bookings/components/BookingDetailsSheet.test.tsxItems for reviewer attention
lastBookingRef.currentis set during render, not insideuseEffect. This is an intentional and common pattern for tracking "previous value" via refs, but worth a look to confirm comfort with this approach.BookingDetailsSheetReact component (it has many dependencies that would require extensive mocking). The transition logic is the same, but the ref behavior in a real React render cycle isn't directly exercised.act,renderHook,React,beforeEach,vi,useStore) — these should be cleaned up.Checklist
Link to Devin run: https://app.devin.ai/sessions/66a9d334a96d43a2b666f3b71052713b
Requested by: @eunjae-lee