Skip to content

electron legends list#29225

Merged
chrisnojima merged 13 commits into
nojima/HOTPOT-next-670-clean-2from
nojima/HOTPOT-electron-legends-1
May 20, 2026
Merged

electron legends list#29225
chrisnojima merged 13 commits into
nojima/HOTPOT-next-670-clean-2from
nojima/HOTPOT-electron-legends-1

Conversation

@chrisnojima
Copy link
Copy Markdown
Contributor

No description provided.

This comment was marked as outdated.

LegendList's scrollToIndex uses estimated item positions for unrendered
items, causing it to land far from the target when estimated sizes are
smaller than actual. Fix by adding data-ordinal to each row and using a
retry loop: attempt scrollIntoView on the element directly, falling back
to scrollToIndex to get closer each time until the element is rendered.

Also extract HighlightableRow so it subscribes to the center context
directly, ensuring re-renders propagate through LegendList's recycled
containers. Disable maintainVisibleContentPosition during centering to
prevent it from fighting the scroll.
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment on lines 309 to 317
<div
data-testid="message-list"
style={Kb.Styles.castStyleDesktop(desktopStyles.container)}
onClick={handleListClick}
onCopyCapture={onCopyCapture}
ref={wrapperRef}
>
<div
data-testid="message-list"
className="chat-scroller"
<LegendList
key={conversationIDKey}
Comment on lines 186 to +193
React.useEffect(() => {
const wasLoaded = wasLoadedRef.current
const changed = prevCenteredOrdinal.current !== centeredOrdinal
prevCenteredOrdinal.current = centeredOrdinal
wasLoadedRef.current = loaded

// Only scroll if we were already loaded and ordinal changed
// (the load effect handles scrolling when loaded transitions to true)
if (!wasLoaded || !loaded || !changed) return

if (!loaded) return
if (centeredOrdinal) {
lockedToBottomRef.current = false
scrollToCentered()
} else if (containsLatestMessage) {
lockedToBottomRef.current = true
scrollToBottom()
if (lastScrolledCenteredRef.current === centeredOrdinal) return
const idx = sortedIndexOf(messageOrdinalsRef.current as unknown as number[], centeredOrdinal as unknown as number)
if (idx < 0) return
lastScrolledCenteredRef.current = centeredOrdinal
const target = centeredOrdinal
| null
)?.querySelector(`[data-ordinal="${target}"]`)
if (el) {
el.scrollIntoView({behavior: 'instant', block: 'center'})
@chrisnojima chrisnojima merged commit 2ad56f5 into nojima/HOTPOT-next-670-clean-2 May 20, 2026
@chrisnojima chrisnojima deleted the nojima/HOTPOT-electron-legends-1 branch May 20, 2026 19:41
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