Conversation
Filter out any duplicate endpoints
2040c3c to
fcaa7bf
Compare
fcaa7bf to
1d4fda5
Compare
|
@aduth - now rebased. Merging the changes wasn't too bad, the tests were a bit trickier, but I've managed to work it out. |
| */ | ||
| function test_localizes_script() { | ||
| $preload_paths = gutenberg_extend_block_editor_preload_paths( array() ); | ||
| $post = (object) array( |
There was a problem hiding this comment.
Is this variable (and in the test below) unused?
There was a problem hiding this comment.
Yep, I made a mistake leaving that there after discovering that I could use the post factory in the test. Thanks for pointing it out.
lib/client-assets.php
Outdated
| * the minimum supported version. | ||
| */ | ||
| $post_type_object = get_post_type_object( $post->post_type ); | ||
| $rest_base = ! empty( $post_type_object->rest_base ) ? $post_type_object->rest_base : $post_type_object->name; |
There was a problem hiding this comment.
While it seems unlikely given the filter flow, it makes me nervous to see null as a possible return type of get_post_type_object and then to have unguarded object property references. Should we be more guarded (wrap this whole bit in an if ( ! is_null( $post_type_object ) ) {)?
There was a problem hiding this comment.
👍 good idea, I've addressed that.
|
It looks like we need to commit this patch as well https://core.trac.wordpress.org/ticket/46974 for WP 5.3 |
Description
Adds a preload path for autosaves to help optimize the changes made in #7945.
Note there is a trac ticket that replicates this functionality in core (https://core.trac.wordpress.org/ticket/46974). In the meantime this should bring the same optimization to the plugin.
How has this been tested?
With this change: no requests to the autosaves endpoint are made when reloading the editor.
Without this change: a request is made to the autosaves endpoint when reloading the editor.
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: