-
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
Editor Settings: Rename the getPostLinkProps setting #58416
Conversation
*/ | ||
export default function usePostHistory( initialPostId, initialPostType ) { | ||
export default function useLoadEntityRecord( initialPostId, initialPostType ) { |
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 did initially have this called useSelectEntityRecord
but it caused a linting error about needing to pass in a callback - the linter was confusing it with useSelect
I think, and likely that naming would be confusing to others as well.
Flaky tests detected in 28d82f7. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7703660591
|
Size Change: +281 B (0%) Total Size: 1.69 MB
ℹ️ View Unchanged
|
Yes, I prefer this personally but curious about what others think as well. |
Left this feedback before, and it's still a strong opinion (though loosely held, I won't be upset if you merge this 😄 ) I still think it's too close to the naming of data APIs, especially the
|
but I could also go with something like
my main grudge was the |
@talldan, @youknowriad, I have renamed to |
522a27a
to
c95e2d0
Compare
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 Core SVNCore Committers: Use this line as a base for the props when committing in SVN:
GitHub Merge commitsIf 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. |
@youknowriad are you happy with this rename now? |
c95e2d0
to
76b3e8a
Compare
@ramonjd, @noisysocks this affects the changes made in #58528 and #58534 - it all still seems to work as expected, but you may want to double check. @talldan, @youknowriad it would be good to get a ✅ on this soon if possible please. It touches a few areas so needing to do a bit of rebasing to keep it current. And we also went to get this in for the 6.5 beta. |
packages/edit-site/src/components/block-editor/use-site-editor-settings.js
Outdated
Show resolved
Hide resolved
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.
Looks good!
I noticed a two bugs, it doesn't look like they were caused by this PR, but would be good things to track and fix for 6.5.
-
In the post editor when selecting 'Preview Template', there's a trailing block appender after the template that shouldn't be there (you can't edit the template in this mode):
-
When editing a pattern in the post editor, there's a lot of empty white space underneath the pattern and a scrollbar. This doesn't happen in the site editor. I think this is the post editor's "click below" area that shouldn't be present in the focused mode:
And finally, I noticed the template-part-edit
hook (that adds the 'edit' button to the template part's toolbar) could potentially be changed to use this new API. Though some care would need to be taken about the post editor experience (currently it doesn't support editing template parts):
https://github.com/WordPress/gutenberg/blob/trunk/packages/edit-site/src/hooks/template-part-edit.js
@@ -472,7 +472,7 @@ test.describe( 'Pattern Overrides', () => { | |||
await editor.showBlockToolbar(); | |||
await page | |||
.getByRole( 'toolbar', { name: 'Block tools' } ) | |||
.getByRole( 'link', { name: 'Edit original' } ) | |||
.getByRole( 'button', { name: 'Edit original' } ) |
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 is perhaps a little controversial, as I think a link is generally considered more semantic and provides better info for screenreaders. 🤔
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.
Yeh, unfortunately until we get proper routing set up in the post editor we can't use a link here, but it would be good to switch it back when/if we have routing in the post editor.
What?
Renames the
getPostLinkProps
andgoBack
editor setting toonNavigateToEntityRecord
onNavigateToPreviousEntityRecord
and removes the href property from the return value in line with feedback here.Why?
The current naming doesn't work well for the wider usage of this setting outside the pattern focused editing it was originally added for. Also, the
href
prop does not work in the post editor so shouldn't be included.How?
Renamed all the relevant hooks, settings, and usages.
Testing Instructions
Template - Edit Template
option in the right post panelTemplate - Create new template
option in right post panel and check it worksTemplate - Edit template
option again and this time make sure theGo back
option in the success snackbar worksGo back
button will not appear in the notification, this is because the routing works differently in the site editor, and the top back link is more prominent