Type error if to click at the very beginning of the scrollbar with lots of items
MKrutii opened this issue · 2 comments
MKrutii commented
Noticed an issue that cause error in the console/rollbar
Expected Behavior
No errors in the console
Current Behavior
TypeError: Cannot read properties of undefined (reading '0')
at t.getTouchY (Scrollbar.js:572:9)
at Scrollbar.js:374:16
at Object.Va (react-dom.production.min.js:52:317)
at Za (react-dom.production.min.js:52:471)
at react-dom.production.min.js:53:35
at Ao (react-dom.production.min.js:100:68)
at Co (react-dom.production.min.js:101:380)
at react-dom.production.min.js:113:65
at Ra (react-dom.production.min.js:292:189)
at react-dom.production.min.js:50:57
Possible Solution
For some reason targetTouches
is undefined, the logic might be improved to have the optional chaining or other solution
Steps to Reproduce (for bugs)
Can be reproducible in the examples page
- Have the table with the lots of items
- Have the vertical/horizontal scrollbar
- Click to the very beginning of the scrollbar
- Observe the error in console
Your Environment
- Browser Name and version: MS Edge latest / Chrome latest
- Operating System and version (desktop or mobile): Win 11 x64
pradeepnschrodinger commented
Oh good find!
targetTouches
is undefined at
fixed-data-table-2/src/plugins/Scrollbar.js
Lines 527 to 537 in 522e82b
because we're actually doing a normal mouse click instead of a "touch" click.
But the code shouldn't have reached here in the first place.
The root problem is that FDT thinks it's a touch event because of the way we use the ||
operator in
fixed-data-table-2/src/plugins/Scrollbar.js
Lines 358 to 364 in 522e82b
We should instead use the
??
operator for cases like this.I'll put a quick fix.
pradeepnschrodinger commented