VirtualScroller: hotfix crash
Fixes urbit/landscape#506
@@ -168,7 +168,7 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
}
startOffset() {
- const startIndex = this.state.visibleItems.peekLargest()?.[0];
+ const startIndex = this.state?.visibleItems?.peekLargest()?.[0];
if(!startIndex) {
return 0;
}
@@ -458,7 +458,7 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
const transform = isTop ? 'scale3d(1, 1, 1)' : 'scale3d(1, -1, 1)';
- const atStart = this.props.data.peekLargest()![0].eq(visibleItems.peekLargest()?.[0] || bigInt.zero)
+ const atStart = this.props.data.peekLargest()?.[0].eq(visibleItems.peekLargest()?.[0] || bigInt.zero);
const atEnd = false;
return (
