-
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
Refactor: Replace postId
with id
in navigation calls across components
#67455
Refactor: Replace postId
with id
in navigation calls across components
#67455
Conversation
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. |
This PR is undergoing some changes, will update here once done. Thanks! |
Update: A bug was identified where using export default function useNavigateToEntityRecord() {
const history = useHistory();
const onNavigateToEntityRecord = useCallback(
( params ) => {
history.navigate(
`/${ params.postType }/${ params.id }?canvas=edit&focusMode=true`
);
},
[ history ]
);
return onNavigateToEntityRecord;
} Using The PR is now ready to be reviewed. |
Opened an alternative PR here #67458 |
Yes @youknowriad, it's just more effective to update the function |
Thank you for working on this. |
Fixes: #67443
What?
This PR resolves a bug in the
onNavigateToEntityRecord
, where theid
parameter was incorrectly referenced aspostId
. This mismatch caused the "Edit" and "Edit Original" buttons to generate URLs containingundefined
, resulting in broken links for editing individual template parts or patterns.How?
The issue was resolved by updating all instances of
onNavigateToEntityRecord
to correctly use theid
parameter instead ofpostId
. This change ensures that valid URLs are generated for editing actions.Testing Instructions
Screenshots or screencast
Screen.Recording.2024-12-02.at.11.43.04.AM.mov