petyosi / react-virtuoso

The most powerful virtual list component for React
https://virtuoso.dev
MIT License
5.25k stars 301 forks source link

[BUG] Incorrect scrollTo in TableVirtuoso #838

Closed evskorobogatij closed 1 year ago

evskorobogatij commented 1 year ago

Describe the bug

const refCnt = useRef<TableVirtuosoHandle>(null)

....

<TableVirtuoso
          ref={refCnt}
 .....

//In code

refCnt.current.scrollTo({left: scrollLeftValue})  // <-- work correct. Scroll left

///
refCnt.current.scrollTo({top: scrollTopValue})  // <-- work corrent. Scroll top 

// refCnt.current.scrollTo({top: scrollTopValue, left: scrollLeftValue })   // <-- bug. Int scroll left and to then bottom of table
/>

Expected behavior

refCnt.current.scrollTo({top: scrollTopValue, left: scrollLeftValue })  // need to scroll to left and top

Additional context

"react": "^18.2.0",
"react-virtuoso": "^3.1.2",
"typescript": "~4.5.0",
petyosi commented 1 year ago

A reproduction of the problem in codesandbox would help me. I will reopen once you provide this.