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 RowClickFunction type to accept false. #8561

Merged
merged 1 commit into from Jan 9, 2023

Conversation

stesie
Copy link
Contributor

@stesie stesie commented Jan 9, 2023

DatagridRow's rowClick property may be provided with a function, that may return a string (to trigger navigation) or false (in order to skip navigation). At least the code would allow to do that, see https://github.com/marmelab/react-admin/blob/master/packages/ra-ui-materialui/src/list/datagrid/DatagridRow.tsx#L113

However typing restricts this (via RowClickFunction) to just support string return types (or promises there of).

This PR changes the type to allow false to be returned as well (both directly or with promise).


Please note that there are further inconsistencies with typing of rowClick on Datagrid itself and DatagridBody, which both disallow rowClick={false} (opposed to DatagridRow). Furthermore DatagridRow.propTypes.rowClick does not allow false value (i.e. conflicts with typing).
This PR ignores this so far, since I'm not directly affected by that and I wasn't sure whether to fix that. Let me know if I should.

Copy link
Contributor

@djhi djhi left a comment

Choose a reason for hiding this comment

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

Thanks!

@djhi djhi added this to the 4.7.1 milestone Jan 9, 2023
@djhi djhi merged commit 3fb15fa into marmelab:master Jan 9, 2023
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