-
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: Use in patterns page #57333
Conversation
Size Change: +1.06 kB (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
Flaky tests detected in 6a58942. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7298932102
|
6a58942
to
d26df02
Compare
packages/edit-site/src/components/page-patterns/dataviews-pattern-actions.js
Outdated
Show resolved
Hide resolved
totalPages: Math.ceil( totalItems / view.perPage ), | ||
}, | ||
}; | ||
}, [ patterns, view, fields ] ); |
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.
Feels like the data views package could expose helpers for local filtering and sorting as I believe the logic here is probably very similar to the templates page as well and any data view where the filtering and sorting is done locally.
}, [ patterns, view, fields ] ); | ||
|
||
const actions = useMemo( () => [ renameAction, exportJSONaction ], [] ); | ||
const onChangeView = useCallback( |
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.
At some point we should consider whether we could bundle this logic as well as it repeats itself across data views usage. We may be able to do so by adding the defaultConfigPerViewType
as a prop.
Also, it seems we're adding more and more "config" props, maybe at some point we could have a "settings" prop with a lot of these instead of keeping them top 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.
Yeah. I'm thinking of landing an initial PR without all the actions too(to reduce the size of this PR) and have some follow ups to simplify things a bit.
packages/edit-site/src/components/page-patterns/dataviews-patterns.js
Outdated
Show resolved
Hide resolved
68dba2c
to
64632a8
Compare
Fixed that.
This is an issue we need to handle in general yes, but I'm not sure it's for this PR. I'm thinking that we could test and land this PR and continue with follow ups due to the big size of the PR. For example to add the What do you think? |
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 as a start
What?
Part of: #55083
This PR is the starting point of using DataViews in patterns page. There is a lots of stuff going on with patterns and this might be also an opportunity to try to simplify the code, but I'm planning to explore this iteratively.
This is a WIP so the description/screenshots and code will change.
Testing Instructions
Tasks
Screenshots or screencast