fix(ui): stabilize virtual list rerender measurements
Keep visible rows mounted during follow-up measurements and clear stale refs so async message rendering no longer flickers or measures detached blocks. Coalesce per-item render notifications so content-heavy rows only trigger one remeasurement per frame.
This commit is contained in:
@@ -787,7 +787,10 @@ export default function MessageBlock(props: MessageBlockProps) {
|
||||
return resultBlock
|
||||
})
|
||||
|
||||
let measuredBlockElement: HTMLDivElement | undefined
|
||||
|
||||
onCleanup(() => {
|
||||
measuredBlockElement = undefined
|
||||
props.onMeasureElementChange?.(null)
|
||||
})
|
||||
|
||||
@@ -797,11 +800,19 @@ export default function MessageBlock(props: MessageBlockProps) {
|
||||
return resolved
|
||||
})
|
||||
|
||||
createEffect(() => {
|
||||
if (visibleBlock()) return
|
||||
if (!measuredBlockElement) return
|
||||
measuredBlockElement = undefined
|
||||
props.onMeasureElementChange?.(null)
|
||||
})
|
||||
|
||||
return (
|
||||
<Show when={visibleBlock()}>
|
||||
{(resolvedBlock) => (
|
||||
<div
|
||||
ref={(el) => {
|
||||
measuredBlockElement = el
|
||||
props.onMeasureElementChange?.(el)
|
||||
}}
|
||||
class="message-stream-block"
|
||||
|
||||
Reference in New Issue
Block a user