Skip to content

fix LegendList deadlock when cached thread data arrives before onLayout#29249

Merged
chrisnojima merged 2 commits into
nojima/HOTPOT-bordersfrom
nojima/HOTPOT-fix-chat-load
May 27, 2026
Merged

fix LegendList deadlock when cached thread data arrives before onLayout#29249
chrisnojima merged 2 commits into
nojima/HOTPOT-bordersfrom
nojima/HOTPOT-fix-chat-load

Conversation

@chrisnojima
Copy link
Copy Markdown
Contributor

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.

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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 layoutReady gate for desktop thread rendering.
  • Passes an empty ordinal list to LegendList until 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 chrisnojima merged commit 163bc2e into nojima/HOTPOT-borders May 27, 2026
1 check was pending
@chrisnojima chrisnojima deleted the nojima/HOTPOT-fix-chat-load branch May 27, 2026 01:22
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants