-
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
Rename view.sort.field
to view.sort.orderby
#55205
Conversation
@@ -45,7 +45,7 @@ export default function DataViews( { | |||
sorting: view.sort | |||
? [ | |||
{ | |||
id: view.sort.field, | |||
id: view.sort.orderby, |
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.
I'm not opinionated about the new name (orderby
or any alternative), but I think it's best to avoid field
for clarity.
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.
Why is field unclear for you?
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.
Why is field unclear for you?
It suggests the table is sorted by a field (fields API), but it is sorted by the dataset instead.
For example, let's say there was a field called date
in addition to the date
property of the dataset. Let's say we have view.sort.field: date
set. Wouldn't it be confusing, given the view is actually sorted by the dataset date
and not by the field date
?
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.
More context about accessing the dataset (underlying raw data) vs accessing the fields (cell value) at #55196 (comment).
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.
I'm not entirely sure what you mean by "dataset". For me it's actually the field. If a dev defines a field that is "full name" that is a computed field from say two properties on the object (first and last name), the sort is the "name" of the field, aka "full name" regardless of how it's really applied under the hood (using two columns to sort for instance)
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.
"columns" is specific to table views, and with the same config we want to be able different kind of views starting with table but also rendering things like "grids", "kanban"... So columns doesn't make sense cross "layout". We're basically just defining the "fields" of our data.
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.
I agree with @youknowriad here. For us this is a field and is using the data
internally temporarily.
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.
Yeah, I agree column(s)
is inherently restrictive to a certain view type, but in my opinion fields(s)
comes with its own connotations, especially in the context of WordPress.
I personally associate it with a single piece of data vs. what has been described as a possible need in the future of combining pieces of data.
I'm not opinionated about the new name (orderby or any alternative), but I think it's best to avoid field for clarity.
(emphasis mine) I think this also applies to fields
(plural) as the higher level.
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.
I have no other suggestion/aternative, so please don't let this hold progress, but something about field(s)
seems as restrictive a column(s)
to me 🤷🏻
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.
ok, I see where you are coming from. Let's wrap up this conversation and iterate towards that vision.
Size Change: +1 B (0%) Total Size: 1.65 MB
ℹ️ View Unchanged
|
Flaky tests detected in d2f213f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6470648610
|
Related #55083
Follow-up to https://github.com/WordPress/gutenberg/pull/55154/files
What?
Renames the
view.sort.field
property toview.sort.orderby
.Why?
Using
field
may lead consumers to think the sorting uses the fields, but it does not. It uses the underlying data for filtering.In our code, the
date
value in the view is used by tanstack as theid
of the values to sort. Thisid
refers to the dataset, not to its columns (our fields). This can be tested by creating a new field whoseid
isdate
and observing how the sorting is still dependent on thedate
from the dataset.Testing Instructions