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 Proptype mitake? #2793

Closed
santaclauze opened this issue Jan 20, 2019 · 2 comments
Closed

DataGrid Proptype mitake? #2793

santaclauze opened this issue Jan 20, 2019 · 2 comments

Comments

@santaclauze
Copy link

santaclauze commented Jan 20, 2019

react-admin 2.6.0

It seems that the Props types of Datagrid has a mistake.

Datagrid.propTypes = {
...
    currentSort: PropTypes.shape({
        sort: PropTypes.string,
        order: PropTypes.string,
    }).isRequired,
...
}

However if I log this.props, I have currentSort: {field: "id", order: "DESC"}. See how it contains field and not sort.

In some resources I also get a warning: Warning: Failed prop type: The prop currentSortis marked as required inDatagrid, but its value is undefined.

I suggest a PR with :

Datagrid.propTypes = {
...
    currentSort: PropTypes.shape({
        field: PropTypes.string,
        order: PropTypes.string,
    }).isRequired,
...
}
...
Datagrid.defaultProps = {
  currentSort: {},
};

@djhi
Copy link
Collaborator

djhi commented Jan 20, 2019

Thanks for reporting! Can you make a PR fixing the proptypes names, removing the isRequired on it but leaving the default as it is?

@santaclauze
Copy link
Author

rdy. Closing

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

No branches or pull requests

2 participants