fix(navigation): hold a neutral surface during the tab-switch activation gap#771
Merged
Conversation
…ion gap Switching content tabs (messages/rooms/archive) via the rail icons briefly flashed the empty-state hero. navigateToView() flips sidebarView and clears the opposite store synchronously, then fires the hydrating activate* action, which awaits an IndexedDB cache read before setting the active id. During that painted gap both active ids are null, so the render cascade fell through to the EmptyState hero. Expose a token-correct activationPending flag on chatStore/roomStore (set before the cache-read await, cleared atomically when the active id lands) and render the existing ViewLoadingFallback skeleton instead of the hero while it is true, matching the lazy views and removing the flash.
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.
Summary
Switching content tabs (Messages / Rooms / Archive) via the rail icons briefly flashed the empty-state hero before the conversation or room rendered.
navigateToView()synchronously flipssidebarViewand clears the opposite store, then fires the hydratingactivateConversation/activateRoomaction. Thoseawaitan IndexedDB cache read before setting the active id — by design, so the view never renders with an empty message list and the unread-divider is computed against loaded messages. That await is a real macrotask, so React commits and paints the in-between frame where bothactiveConversationIdandactiveRoomJidare null whilesidebarViewis already a content view, and the render cascade falls through to theEmptyStatehero. The lazy tabs (Settings / Admin / Search) never showed this because they sit behind aSuspenseskeleton; the content tabs had nothing covering the gap.This adds a token-correct
activationPendingflag tochatStoreandroomStore— set synchronously before the cache-read await and cleared atomically when the active id lands (the existing monotonic activation token means a superseded activation leaves the flag for the winner to clear). ChatLayout renders the existingViewLoadingFallbackskeleton instead of theEmptyStatehero while it is true, so content-tab switches now match the lazy tabs and the hero no longer pops in and out.activationPendingis also a useful signal for any client built on the SDK, which hits the same flash.