-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
DataViews: update sorting semantics #56717
Conversation
Size Change: -24 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
This part is working 👍 I am noticing some strange behavior though, potentially unrelated to this PR, but figured I'd note them down. sorting.mp4
|
Tried with in pages and templates, but I cannot reproduce (tested with and without pagination) 🤔 Gravacao.do.ecra.2023-12-01.as.16.49.32.movGravacao.do.ecra.2023-12-01.as.16.48.36.mov |
I don't see why this is bad? Sometimes it will be visible how the items are sorted by default and sometimes not, but in the end if we sort by one field, I don't see the reason why a user cannot reset to the default sorting that was used. |
For me, it's about whether "unsorting" is a use case we need to support and what's the complexity that comes with it. It's not good or bad, but a trade-off. I am concerned that supporting "unsorting" forces us to stretch the semantics of the UI components (radios cannot have an "unset" status after they are set). See #55625 (comment) and #55625 Of course, if there were use cases, we just find engineering solutions for it. My point is that I don't see any use case, hence why I argue we should make it work like the pagination or layout options, for example. Do you feel strongly about maintain this behavior? Is there a use case you have in mind? |
d1cb3fc
to
8d4b010
Compare
Not really, but I think it's something we could decide later on and leave as is for now. I'm fine if others also think we should remove. |
In case we wanted to preserve the behavior, we could add an extra radio option called |
8d4b010
to
18f483d
Compare
The current sorting behavior is blocking #55625 Unless we come up with any other suggestion, our options forward are 1) making it work like a radio (this PR) or 2) add a none option (which design seems to be against, and it's different from how the other things work). To prevent 55625 from being blocked, I'd rather do 1 and revisit if necessary. cc @ciampo or @andrewhayward is the above summary fair? are you perhaps available to approve this approach so we unblock 55625? |
Flaky tests detected in 18f483d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7165419457
|
My instinct is that it's fine to proceed with this PR. Unsorting doesn't really make sense as there will always be a sort order, even if it's the default one (which should be represented in the UI accordingly). If toggling off sort order for one field also toggles sorting on for another I think that might feel a bit unexpected. Imo it's more natural to choose a new sort order than to disable the current one. If a need for a "Reset to default sorting" arises we can explore a design for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To prevent #55625 from being blocked, I'd rather do 1 and revisit if necessary.
Sounds like a plan, let's move forward
🚀
Part of #55083
What?
This PR updates the sorting semantics so that once the dataset is sorted, it cannot be "unsorted":
Gravacao.do.ecra.2023-12-01.as.15.42.54.mov
Why?
What does it mean to "unsort" something that's already sorted? It means that it's up to the dataset source (pages endpoint, templates endpoint, etc.) to provide the data in whatever default sorting it provides – the dataset is sorted, we just don't know how.
By aligning sorting semantics with the other view configs that have a single option (pagination or layouts), its UI representation also becomes clear (see refactoring to new components and discussion about checkboxes/radios).
How?
Update
ViewActions
andViewTable
so that sorting cannot be unset, once it is set.Testing Instructions