-
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
Metaboxes: Prefetch Metaboxes and don't reload them on save #3616
Conversation
cc8ad96
to
732d7f0
Compare
Codecov Report
@@ Coverage Diff @@
## master #3616 +/- ##
==========================================
- Coverage 37.74% 37.41% -0.33%
==========================================
Files 279 277 -2
Lines 6743 6676 -67
Branches 1227 1209 -18
==========================================
- Hits 2545 2498 -47
+ Misses 3536 3525 -11
+ Partials 662 653 -9
Continue to review full report at Codecov.
|
I like how this removes a lot of code :) |
Yeah, going to check this out more in depth, but now that we are on post.php this is more the approach we should head. We don't need to fake things anymore since we are just on post.php. Great stuff so far! |
527785b
to
aafe321
Compare
Do you all agree on moving forward with this direction? |
* @param array $wp_meta_boxes Global meta box state. | ||
*/ | ||
$wp_meta_boxes = apply_filters( 'filter_gutenberg_meta_boxes', $wp_meta_boxes ); | ||
|
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.
Now that we're loading it inline, we should call gutenberg_intercept_meta_box_render()
here - it should be done immediately before the do_meta_boxes()
calls.
I'm inclined to not attach it to filter_gutenberg_meta_boxes
, to prevent anything from being added to $wp_meta_boxes
after it runs.
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 thought the gutenberg_intercept_meta_box_render
was meant to display a warning in the classic editor while the_gutenberg_metaboxes
renders the metaboxes in Gutenberg.
Am I missing something?
Anyway, feel free to push any change to this branch
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.
Oh, wait. Yeah, I totally wasn't reading it right. 🙂
aafe321
to
07187b6
Compare
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.
To be clear, is the idea that we're abandoning any attempt to keep the meta boxes up to date since they don't always work well with auto-save or otherwise long-lived page sessions?
<input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" /> | ||
<!-- These fields are not part of the standard post form. Used to redirect back to this page on save. --> | ||
<input type="hidden" name="gutenberg_meta_boxes" value="gutenberg_meta_boxes" /> | ||
<input type="hidden" name="gutenberg_meta_box_location" value="<?php echo esc_attr( $location ); ?>" /> |
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.
Notice: Undefined variable: location in /srv/www/editor/htdocs/wp-content/plugins/gutenberg/lib/meta-box-partial-page.php on line 390
I'd not phrase it like this, There are two things:
|
I guess this was easier with iframes, since they were standalone documents, but is there no way to mimic the document readying events for plugin metaboxes? |
Nothing that I'm aware of. Even regular |
8014329
to
10acc3e
Compare
10acc3e
to
3639678
Compare
Merging. Most concerns addressed and the code is way cleaner with this |
The idea is that the metaboxes needs to be loaded with Gutenberg on initial load to initialize properly and their HTML don't need to be updated on Save.
So this does:
closes #3523 #3277