-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix undefined
error due to columnIdx
out of bounds
#3372
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3372 +/- ##
==========================================
+ Coverage 83.15% 83.17% +0.02%
==========================================
Files 47 47
Lines 5092 5100 +8
Branches 795 796 +1
==========================================
+ Hits 4234 4242 +8
Misses 858 858
|
src/DataGrid.tsx
Outdated
@@ -690,6 +690,7 @@ function DataGrid<R, SR, K extends Key>( | |||
function isCellEditable(position: Position): boolean { | |||
return ( | |||
isCellWithinViewportBounds(position) && | |||
position.idx !== -1 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isCellWithinViewportBounds
doesn't catch this? 🤔
Should we add a test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It uses https://github.com/adazzle/react-data-grid/blob/main/src/DataGrid.tsx#L674 and minColIdx === -1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be we need to add a new function withinEditBounds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how to test it. I will check
* Check columnIdx is within bounds * Add helper * Inline
Closes #3369