T
TanStack2y ago
complex-teal

Missing attribute name 'data-index={index}' on measured element, when it clearly exists

When trying to virtualize our list of messages I copied everything almost exactly from the dynamic example, while modifying it to fit our use case and solidjs, everything seemed to work until I tried scrolling and experienced jittering, while the console constantly outputted the error. Snippet of the virtualized element

<div data-index={virtualRow.index} ref={virtualizer.measureElement}>
<Message
refMsg={msgRef}
same={same}
setReference={props.setReplyingTo}
message={props.messages()[virtualRow.index]}
updateMessage={props.updateMessage}/>
</div>

<div data-index={virtualRow.index} ref={virtualizer.measureElement}>
<Message
refMsg={msgRef}
same={same}
setReference={props.setReplyingTo}
message={props.messages()[virtualRow.index]}
updateMessage={props.updateMessage}/>
</div>
The error in question:
No description
1 Reply
complex-teal
complex-tealOP2y ago
we figured it out, it happens because the measureElement function runs before the attribute gets assigned haven't checked if this solves our problem tho

Did you find this page helpful?