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

Change the definition of sort order to ASC|DESC #8466

Merged
merged 5 commits into from
Aug 31, 2023

Conversation

zhujinxuan
Copy link
Contributor

@zhujinxuan zhujinxuan commented Dec 5, 2022

Currently order in SortPayload type definition is a general string, but it shall be ASC or DESC in accordance with the docs and sort clicks in Datagrid This PR changes the definition of order to ASC|DESC

I also changed some desc in spec or demo files to DESC, because, if we use Datagrid from the react-admin, then our order would be predefined DESC or ASC, not the small cased desc or asc.

@slax57
Copy link
Contributor

slax57 commented Dec 8, 2022

Thanks for your contribution.

You are correct, there are places in the code where we actually expect the value to be one of these, but since it's not currently enforced, I'm afraid that restricting the allowed types may break things.
We must investigate to make sure that it doesn't break things in some edge cases.
But it's not top priority for us, so we won't do that in the near future.

@zhujinxuan
Copy link
Contributor Author

zhujinxuan commented Dec 8, 2022

Got it! I totally understand that there is a risk regarding the type definition change. I will leave this PR here and it is totally upon your decision on what to do with the PR.

@fzaninotto
Copy link
Member

Hi, and sorry it took us so long to look at your PR. We're ready to move forward.

I've merged master to your branch to resolve conflicts, and now there are new errors. Would you mind taking a look?

Also, as there may be an impact on some codebases, I'd prefer that we publish this change in a minor release. Would you mind rebasing on next instead of master?

@zhujinxuan
Copy link
Contributor Author

zhujinxuan commented Aug 28, 2023

Yes, I will do that on Friday.
Done. Would you like to have a look again?

Would you like me making a new PR for the next branch and closing this PR? So the change will only affect the next major release rather than minor release.
I didn't know I can change the rebase here. So I will keep changes in this PR.

Copy link
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

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

Code looks good to me, thanks!

@slax57 slax57 added this to the 4.14.0 milestone Aug 31, 2023
@slax57 slax57 merged commit 4199bfd into marmelab:next Aug 31, 2023
7 checks passed
@fkowal
Copy link
Contributor

fkowal commented Sep 15, 2023

not to be a buzz kill

but this is a pain for ie. ra-data-hasura

where there are more sorting options
desc_null_last
or multicolumn sort {field: 'col1,col2', order: 'asc,desc'}

i'd revise the reasoning behind this change and revert the ts order: type back to string

@fzaninotto
Copy link
Member

Thanks for your feedback.

Compound sort order values aren't compatible with our datagrid headers, which expect a single order. Can you explain how you manage datagrids in this case?

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.

4 participants