-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: consider layout url parameter when loading a default/custom view #64306
Conversation
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. |
Size Change: +24 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
@@ -41,7 +41,7 @@ export default function DataViewItem( { | |||
} | |||
const linkInfo = useLink( { | |||
postType, | |||
layout, | |||
layout: type, |
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 happens if we drop this argument entirely. I think it's not needed right?
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.
It is. Otherwise, the dataview & the site editor's layout get out of sync (in the video below, the default trash view & the custom ThemeBuster view use table, but the site editor's layout is not updated accordingly) :
Gravacao.do.ecra.2024-08-07.as.13.55.54.mov
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, the router assumes the default value is "list" if the layout is not present.
Follow-up to #63889
What?
In the Pages page, consider the
layout
parameter when loading a view.Why?
URLs represent (partially) the state of DataViews, and it needs to load properly.
How?
Testing Instructions
Visit the Pages page in Site Editor and verify a few flows: