-
Notifications
You must be signed in to change notification settings - Fork 4.7k
DataViews: Add onReset prop for view persistence reset #75093
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
base: trunk
Are you sure you want to change the base?
Conversation
Adds a new `onReset` prop to the DataViews component that enables a centralized Reset button in the view config dropdown. This replaces the ad-hoc reset buttons previously scattered across consumer pages. The prop accepts three values: - `undefined`: No persistence support, no reset button rendered - `false`: Persistence supported but view not dirty, shows disabled Reset button - `() => void`: Callback to reset the view, shows active Reset button and blue dot indicator on cog icon Changes: - Add `onReset` prop to DataViews component and context - Add Reset button in view config dropdown header (next to "Appearance" title) - Add blue dot indicator on cog icon when view is modified - Remove standalone reset buttons from post-list, page-templates, page-patterns Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
1 similar comment
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Remove ad-hoc reset buttons from Page actions in routes files and use the new onReset prop on DataViews component instead. Files updated: - routes/post-list/stage.tsx - routes/template-part-list/stage.tsx - routes/template-list/stage-activation.tsx - routes/template-list/stage-legacy.tsx - routes/pattern-list/stage.tsx - routes/navigation-list/stage.tsx Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
What?
Adds a new
onResetprop to the DataViews component that enables a centralized Reset button in the view config dropdown. This replaces the ad-hoc reset buttons previously scattered across consumer pages.Why?
Previously, each page that used
useViewhad to implement its own "Reset view" button in the Page actions area. This led to:How?
The new
onResetprop accepts three values:undefinedfalse() => voidScreenshot
The screenshot shows:
Testing Instructions
Files Changed
packages/dataviews/src/components/dataviews-context/index.ts- AddonResetto context typepackages/dataviews/src/dataviews/index.tsx- AddonResetproppackages/dataviews/src/components/dataviews-view-config/index.tsx- Add Reset button and blue dot indicatorpackages/dataviews/src/components/dataviews-view-config/style.scss- Add stylespackages/edit-site/src/components/post-list/index.js- Use new prop, remove old buttonpackages/edit-site/src/components/page-templates/index.js- Use new prop, remove old buttonpackages/edit-site/src/components/page-patterns/index.js- Use new prop, remove old buttonpackages/edit-site/src/components/page-templates/index-legacy.js- Use new prop, remove old button🤖 Generated with Claude Code