Skip to content
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 crash when rows are undefined #2197

Merged
merged 1 commit into from
Nov 2, 2020
Merged

Fix crash when rows are undefined #2197

merged 1 commit into from
Nov 2, 2020

Conversation

nstepien
Copy link
Contributor

Rows can be undefined, so copiedCell?.row === row can be true when copiedCell is nullish.

@nstepien nstepien self-assigned this Oct 31, 2020
@@ -842,7 +842,7 @@ function DataGrid<R, SR>({
onRowClick={onRowClick}
rowClass={rowClass}
top={top}
copiedCellIdx={copiedCell?.row === row ? columns.findIndex(c => c.key === copiedCell.columnKey) : undefined}
copiedCellIdx={copiedCell !== null && copiedCell.row === row ? columns.findIndex(c => c.key === copiedCell.columnKey) : undefined}
Copy link
Contributor

@amanmahajan7 amanmahajan7 Nov 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are looping through rows and rows type is readonly R[]; I am not sure when can row be undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R can be undefined like in our million cells demo.

@amanmahajan7 amanmahajan7 merged commit 0c18073 into canary Nov 2, 2020
@amanmahajan7 amanmahajan7 deleted the crash branch November 2, 2020 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants