fix LegendList deadlock when cached thread data arrives before onLayout#29249
Merged
Conversation
When initialScrollAtEnd=true and a cached RPC response arrives before LegendList's ResizeObserver fires, handleInitialScrollDataChange returns early (queuedInitialLayout=false), leaving didFinishInitialScroll=false permanently and rendering nothing. Gate data delivery with a rAF so layout always fires before data arrives.
…etState in effect
There was a problem hiding this comment.
Pull request overview
This PR works around a desktop chat rendering deadlock in LegendList by delaying message data delivery until after layout has had a chance to initialize.
Changes:
- Adds a
layoutReadygate for desktop thread rendering. - Passes an empty ordinal list to
LegendListuntil the one-frame delay completes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+87
to
+95
| React.useLayoutEffect(() => { | ||
| if (centeredOrdinal !== undefined) { | ||
| setLayoutReady(true) | ||
| return | ||
| } | ||
| setLayoutReady(false) | ||
| const id = requestAnimationFrame(() => setLayoutReady(true)) | ||
| return () => cancelAnimationFrame(id) | ||
| }, [conversationIDKey]) |
chrisnojima
added a commit
that referenced
this pull request
May 27, 2026
* docs: add border() helper + style analysis skill design spec * feat: add Kb.Styles.border() helper * feat: add style analysis script (extract + analyze phases) * feat: add keybase-style-analysis skill and implementation plan * refactor: apply Kb.Styles.border() in chat/audio and chat/conversation * refactor: apply Kb.Styles.border() in devices and provision * refactor: apply Kb.Styles.border() in chat/emoji-picker and common-adapters * refactor: apply Kb.Styles.border() in teams * docs: remove border helper plan and spec docs * WIP * feat: add topDivider, roundedBottom, textEllipsis, paddingH/V, marginH/V, size helpers * feat: add gap detection for topDivider, roundedBottom, textEllipsis, paddingH/V, marginH/V, size * refactor: apply Kb.Styles.topDivider() * refactor: apply Kb.Styles.roundedBottom() * refactor: apply Kb.Styles.textEllipsis * refactor: apply Kb.Styles.paddingH() * refactor: apply Kb.Styles.paddingV() * refactor: apply Kb.Styles.marginH() * fix: exclude string margin values from marginH gap detector * refactor: apply Kb.Styles.marginV() * refactor: apply Kb.Styles.marginV() at remaining wrapper.tsx site * fix: widen size() to accept percentage strings; exclude undefined from size gap detector * refactor: apply Kb.Styles.size() * fix: add new style helpers to Styles mock in confirm.test.tsx * WIP * WIP * WIP * WIP * WIP * fix LegendList deadlock when cached thread data arrives before onLayout (#29249) * fix LegendList deadlock when cached thread data arrives before onLayout When initialScrollAtEnd=true and a cached RPC response arrives before LegendList's ResizeObserver fires, handleInitialScrollDataChange returns early (queuedInitialLayout=false), leaving didFinishInitialScroll=false permanently and rendering nothing. Gate data delivery with a rAF so layout always fires before data arrives. * fix lint: derive layoutReady from key comparison, avoid synchronous setState in effect
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.
When initialScrollAtEnd=true and a cached RPC response arrives before LegendList's ResizeObserver fires, handleInitialScrollDataChange returns early (queuedInitialLayout=false), leaving didFinishInitialScroll=false permanently and rendering nothing. Gate data delivery with a rAF so layout always fires before data arrives.