console: fix WebSocket race and route-remount data flicker#36624
Merged
leedqin merged 1 commit intoMay 19, 2026
Conversation
The hook and the connection manager both initiated WebSocket connects on first mount; on Safari, closing the still-CONNECTING socket from the second call sometimes stranded the next one in CONNECTING (CNS-77). Route the hook's reconnect signals through the manager and add a connectInFlight guard so overlapping triggers serialize. Separately, navigating away and back to Data Explorer would clobber the cached atom with the fresh SubscribeManager's empty pre-snapshot state, causing the spinner to flash. Hold the cached snapshot in useGlobalUpsertSubscribe until the new manager has data.
Alphadelta14
approved these changes
May 19, 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.
This fixes CNS-77 where the data explorer spinner keeps spinning for a while. Reported by @sjwiesman and @frankmcsherry , I have only been able to repro this in Safari. Iterated in this draft fix PR: #36613 , there is a race condition in the websocket hook useEffects that initiates the Websocket connection and the second effect kills the
CONNECTINGsocket. I refactored to route theuseAutomaticallyConnectWebsocketreconnect signals in the Websocket Connection Manager and added a guard to serialize the overlapping triggers.Fixed another bug that happens when a user navigates away from Data Explorer page and comes back, it reloads the page. Coming back to Data Explorer, opens a new Websocket connection and reset the state that clobbered the existing snapshot. Fixed the hook
useGlobalUpsertSubscribeto hold the cached snapshot until new manager has the data.Verification
Before:
data_explorer_spinning.mov
exploer_spin_flicker_fix.mov