We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Error: Unexpected undefined
1 parent af86ab9 commit 9e33cdbCopy full SHA for 9e33cdb
.changeset/chatty-ravens-stay.md
@@ -0,0 +1,5 @@
1
+---
2
+'@tanstack/virtual-core': patch
3
4
+
5
+fix(virtual-core): fix `Error: Unexpected undefined`
packages/virtual-core/src/index.ts
@@ -998,9 +998,10 @@ export class Virtualizer<
998
)
999
1000
if (elementInDOM) {
1001
- const [latestOffset] = notUndefined(
1002
- this.getOffsetForIndex(index, align),
1003
- )
+ const result = this.getOffsetForIndex(index, align)
+ if (!result) return
+ const [latestOffset] = result
1004
1005
const currentScrollOffset = this.getScrollOffset()
1006
if (!approxEqual(latestOffset, currentScrollOffset)) {
1007
this.scrollToIndex(index, { align, behavior })
0 commit comments