Error when initializing virtual list with defined scrollToIndex
mskocik opened this issue · 0 comments
mskocik commented
When property scrollToIndex
has value, it result in following error. See REPL
can't access lexical declaration 'state' before initialization
This is due initialization check not expecting scrollToIndex
can have initial value;
Fix is easy - add check also for items.length
for state.offset
initialization:
// VirtualList.svelte: 62
let state = {
offset: scrollOffset || (scrollToIndex != null && items.length && getOffsetForIndex(scrollToIndex)) || 0,
scrollChangeReason: SCROLL_CHANGE_REASON.REQUESTED,
};