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

[DataGrid] apiRef.current.getRow can return null #2010

Merged
merged 6 commits into from
Jul 6, 2021

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Jul 1, 2021

See #1995 (comment)

For getRowParams / getCellParams / getBaseCellParams I could return null instead of throwing, but it would mean checking if the return value is null in a lot more places.

For getCellValue if I return null we could not differentiate a cell with the value null and a cell with a non existing ID

For selectRow, I had to update the test because we were asking for a row that do not exist but we never checked the return value of the function in the tests. I don't know what is the best behavior here, does it make sense to return null instead of crashing ?

@flaviendelangle flaviendelangle self-assigned this Jul 1, 2021
@flaviendelangle flaviendelangle changed the title [typescript] apiRef.current.getRow can return undefined [typescript] apiRef.current.getRow can return null Jul 1, 2021
@flaviendelangle flaviendelangle requested a review from a team July 2, 2021 07:36
@oliviertassinari oliviertassinari changed the title [typescript] apiRef.current.getRow can return null [DataGrid] apiRef.current.getRow can return null Jul 5, 2021
@oliviertassinari oliviertassinari added the component: data grid This is the name of the generic UI component, not the React module! label Jul 5, 2021
@flaviendelangle flaviendelangle merged commit abfb0cd into mui:master Jul 6, 2021
@flaviendelangle flaviendelangle deleted the getRow-typing branch July 6, 2021 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants