-
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 the data views component to pass an view object #55154
Conversation
isLoading, | ||
paginationInfo, | ||
options, | ||
options: { pageCount }, |
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.
My goal is to actually eliminate this prop and the paginationInfo one. The remaining information should probably be part of "data" but I'll think about these separately, the current PR just focuses on the "view config".
search: '', | ||
page: 0, | ||
perPage: 5, | ||
sort: { |
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.
Ultimately, we may want to support an array here but let's keep the existing behavior for now.
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.
Probably better to rename column
->field
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.
Makes sense 👍
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.
What do you think about #55205 ?
Size Change: +1.21 kB (0%) Total Size: 1.65 MB
ℹ️ View Unchanged
|
sort: { | ||
column: 'date', | ||
direction: 'desc', | ||
}, |
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.
Right now, the visible columns is an internal property, I think we may want to add this to this object later.
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.
Yes. Fields visibility should be tied to a view and in the future also probably handle some more meta like visibility in mobile.
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.
There are also some field metadata related to UI that could also be part of the view. For example, we currently set maxWidth via the fields (and there could be other widths according to the only docs I could find).
I'm thinking of a situation where the views are customized per user/role/etc. or even updated real-time in collaborative editing. In that scenario, the width of the columns seems like an important UI detail to maintain in the view entity – so it can be updated/synchronized/etc.
Flaky tests detected in b582669. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6455335861
|
} ) { | ||
const dataView = useReactTable( { | ||
data, | ||
columns: fields, | ||
...options, | ||
manualSorting: true, |
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.
For now we can add these internally(manualSorting
and the rest manual props), but if we feed the component with static data, these should not be set to true
values.
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'd like for these to remain internal implementation detail, we may have a way to check whether the data is static or not depending on the "data" props we provide later.
@@ -84,6 +73,9 @@ export default function PagePages() { | |||
method: 'HEAD', | |||
parse: false, | |||
} ).then( ( res ) => { | |||
// TODO: store this in core-data reducer and |
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.
@youknowriad is there an open issue for this to follow?
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.
No, no issue at the moment, I was thinking about adding a todo list item to the data views overview issue
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.
This should be addressed in #55164
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.
LGTM, thanks!
Related to #55083
What?
This is a small refactoring PR that updates the new Pages list in the site editor extracts all the config of the view into a single object. This will allow us down the road to persist this object in the server if needed.
Testing Instructions
1- Open Site Editor > Pages > Manage all pages
2- Play with the UI: filtering, sorting, pagination...