Update @wordpress packages for 6.3 RC2#4892
Update @wordpress packages for 6.3 RC2#4892tellthemachines wants to merge 2 commits intoWordPress:trunkfrom
@wordpress packages for 6.3 RC2#4892Conversation
ramonjd
left a comment
There was a problem hiding this comment.
I went through the commit list in WordPress/gutenberg#52863 and tested functionality.
LGTM
|
Unit test failures seem to be due to this change; looking into it |
audrasjb
left a comment
There was a problem hiding this comment.
THanks for the PR!
I have two docblock changes :)
src/wp-includes/blocks/footnotes.php
Outdated
| '_wp_put_post_revision', | ||
| /** | ||
| * Keeps track of the revision ID for "rest_after_insert_{$post_type}". | ||
| * |
There was a problem hiding this comment.
It's missing a since declaration here :)
There was a problem hiding this comment.
Ah, so anonymous functions should also receive @since?
There was a problem hiding this comment.
Why are these all anonymous functions in the first place?
Makes it impossible for developers to unhook them.
There was a problem hiding this comment.
I personally like anonymous functions for handling the footnote meta because it makes the way to move to handling postmeta revisions in a more standard way in 6.4.
Unless you think we'd still want the named functions after doing so?
There was a problem hiding this comment.
That would indeed be an argument for keeping them, but not sure if that's the reason for it?
There was a problem hiding this comment.
Because this is a temporary fix and to avoid having to rename/naming clashes
There was a problem hiding this comment.
Does this seem like an appropriate reason for using anonymous functions to you, @swissspidy ? (+cc: @peterwilsoncc and @joemcgill ).
If not, do you think we should continue discussion about this in the existing issue about revision support or open a new issue?
It sounded like there may be platform considerations for using named functions here, and I want to make sure those are well understood.
src/wp-includes/blocks/footnotes.php
Outdated
| * @param int $revision_id The revision ID. | ||
| */ | ||
| static function( $revision_id ) { | ||
| global $_gutenberg_revision_id; |
There was a problem hiding this comment.
What about the gutenberg prefix here. Is that okay?
There was a problem hiding this comment.
Also quite a hacky workaround in general having to use such a global here :/
There was a problem hiding this comment.
I understand this is a temporary situation until revisions properly support post meta in core.
There was a problem hiding this comment.
Open for any better workarounds. It's quite late now to be adding general post meta revision support or start changing the REST API hook order.
src/wp-includes/blocks/footnotes.php
Outdated
| global $_gutenberg_revision_id; | ||
|
|
||
| if ( $_gutenberg_revision_id ) { | ||
| $revision = get_post( $_gutenberg_revision_id ); |
There was a problem hiding this comment.
Wondering if we should use wp_get_post_revision here? It implements get_post, but has extra revision-specific checks that get_post doesn't.
Well, namely
if ( 'revision' !== $revision->post_type ) {
return null;
}😄
|
I agree with the feedback about the way revisions are being handled in this PR not being ideal. However, I assume these changes will need to be made in the Gutenberg repo so they don't get overwritten during a future sync? |
peterwilsoncc
left a comment
There was a problem hiding this comment.
I agree with @swissspidy that it would be preferable to move the anonymous functions to named functions to allow developers to unhook them.
If this requires changes to the Gutenberg repo, then I think it's fine to commit as is for the purposes of this week's RC to allow a little extra time to get the upstream patches in.
|
Thanks for the feedback folks! We have to make a change in gutenberg already to address the PHP test errors, so I think we can do the renaming while we're at it. |
|
Further fixes from WordPress/gutenberg#52915 will be updated in the packages |
Packages (wp/6.3) are ready for sync |
dddca08 to
84f2b13
Compare
|
Ok folks I think we've addressed all the feedback now! |
| } | ||
| } | ||
|
|
||
| foreach ( array( 'post', 'page' ) as $post_type ) { |
There was a problem hiding this comment.
Shouldn't this support all post types using the block editor and/or have revision support enabled?
There was a problem hiding this comment.
I think this conversation / issue may be related:
WordPress/gutenberg#52812
There was a problem hiding this comment.
|
I left this further up in the review, but thought it should be here as well so it ends up in the ticket. My understanding was that the anonymous functions were being used to help with a move to handling postmeta revisions in a more standard way in 6.4. Do y'all think we'd still want the named functions after doing so? Edit: To be clear, given committer support above, I am not intending this comment as a blocker for merge for RC2, but for clarification + so the conversation happens. |
Maybe, but there's no explanation at WordPress/gutenberg#52686 from what I can see.
If there's no concern with back compat / tech debt, I suppose we can keep them anonymous until 6.4 lands 👍 Another thing I find very concerning in general is that this post meta revision support is a late-stage enhancement with no unit tests at all. Not to mention WordPress/gutenberg#52812 Right now I tend to agree with this comment by Ella:
|
|
^ cc: @ellatrix in case you want to give any additional feedback on the couple concerns / topics being talked about |
I'm considering this to be a bug fix, not an enhancement, because it would not be expected that footnotes stay unchanged when reverting to a previous revision. The fact that this happens because footnotes are tied to post meta is an implementation detail; the behaviour is still buggy. I agree that it would be good to have some unit tests though. Regarding the functions: I changed them to named functions based on the previous feedback. I'm not too concerned one way or the other as I guess the worst case is they'll have to be deprecated once proper support for post meta in revisions is implemented. But changing them back at this point will require a Gutenberg PR and re-publishing the npm packages, and my bedtime is fast approaching 😅 so I'll have to leave that for someone else to do. Note that I've already committed this changeset to trunk here. |
|
There is an e2e test for revisions. We can add more flows if anyone sees a need. |
|
Closing this one as it landed in the release branch in https://core.trac.wordpress.org/changeset/56305. |
Trac ticket: https://core.trac.wordpress.org/ticket/58885
Updated packages with bugfixes from WordPress/gutenberg#52863 and WordPress/gutenberg#52915.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.