Skip to content
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

Post Editor: Preload templates post type permissions #42209

Merged
merged 3 commits into from
Jul 13, 2022

Conversation

Mamaduka
Copy link
Member

@Mamaduka Mamaduka commented Jul 7, 2022

What?

Resolves #33994.

PR adds preloading for templates post-type permissions.

Why?

We usually preload permissions for the post types used in the editor. It also improves the time to render a bit for the PostTemplate component.

Testing Instructions

  1. Open a Post or Page
  2. Open the DevTools Network tab and filter for templates
  3. Confirm that the OPTIONS request isn't made

Screenshots or screencast

CleanShot 2022-07-07 at 09 02 59

@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. REST API Interaction Related to REST API [Feature] Template Editing Mode Related to the template editor available in the Block Editor labels Jul 7, 2022
@Mamaduka Mamaduka self-assigned this Jul 7, 2022
@Mamaduka Mamaduka requested a review from noisysocks July 7, 2022 05:05
@Mamaduka Mamaduka requested a review from gziolo July 7, 2022 07:19
@Mamaduka
Copy link
Member Author

Mamaduka commented Jul 9, 2022

Hmm, I think this should go into the compat\wordpress-6.2 directory. @gziolo, what do you think?

@noisysocks
Copy link
Member

6.1 is the next planned WordPress release so I think you have it right.

@noisysocks
Copy link
Member

noisysocks commented Jul 11, 2022

Just to be clear, you're talking about the PostTemplate component in the post editor sidebar, yeah?

Here's a sincere question that I do not know the answer to that I think warrants discussion: do you think it's worth preloading REST API requests for components that are in the sidebar?

Preloading a REST API request makes a component appear faster but comes at the cost of increasing TTFB because the server has to perform more database requests. For a component which is a primary part of the user interface (e.g. BlockList, PostPublishButton) this probably always makes sense, but does it make sense for auxiliary components?

If we decide "no" then an alternative is to keep the REST API requests happening after page load but improve the loading state of these components e.g. display a placeholder.

Would like to know what you think!

@Mamaduka
Copy link
Member Author

Just to be clear, you're talking about the PostTemplate component in the post editor sidebar, yeah?

@noisysocks, that's more of a visible side effect.

do you think it's worth preloading REST API requests for components that are in the sidebar?

Maybe not everything, but OPTIONS request used for capabilities shouldn't be heavy on the server.

Copy link
Member

@noisysocks noisysocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright 👍

@Mamaduka Mamaduka merged commit 3da8abf into trunk Jul 13, 2022
@Mamaduka Mamaduka deleted the try/preload-template-permissions branch July 13, 2022 04:33
@github-actions github-actions bot added this to the Gutenberg 13.7 milestone Jul 13, 2022
pento pushed a commit to WordPress/wordpress-develop that referenced this pull request Sep 6, 2022
This is a path for following changes in the Gutenberg plugin:
* [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions]
* [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions].

Follow-up to [43815], [44172], [46110], [51962], [52995].

Props Mamaduka, bernhard-reiter, TimothyBlynJacobs.
See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54084 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Sep 6, 2022
This is a path for following changes in the Gutenberg plugin:
* [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions]
* [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions].

Follow-up to [43815], [44172], [46110], [51962], [52995].

Props Mamaduka, bernhard-reiter, TimothyBlynJacobs.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54084


git-svn-id: http://core.svn.wordpress.org/trunk@53643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
github-actions bot pushed a commit to platformsh/wordpress-performance that referenced this pull request Sep 6, 2022
This is a path for following changes in the Gutenberg plugin:
* [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions]
* [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions].

Follow-up to [43815], [44172], [46110], [51962], [52995].

Props Mamaduka, bernhard-reiter, TimothyBlynJacobs.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54084


git-svn-id: https://core.svn.wordpress.org/trunk@53643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
pbearne pushed a commit to pbearne/wordpress-develop that referenced this pull request Sep 9, 2022
This is a path for following changes in the Gutenberg plugin:
* [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions]
* [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions].

Follow-up to [43815], [44172], [46110], [51962], [52995].

Props Mamaduka, bernhard-reiter, TimothyBlynJacobs.
See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54084 602fd350-edb4-49c9-b593-d223f7449a82
whereiscodedude pushed a commit to whereiscodedude/wpss that referenced this pull request Sep 18, 2022
This is a path for following changes in the Gutenberg plugin:
* [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions]
* [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions].

Follow-up to [43815], [44172], [46110], [51962], [52995].

Props Mamaduka, bernhard-reiter, TimothyBlynJacobs.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54084
ootwch pushed a commit to ootwch/wordpress-develop that referenced this pull request Nov 4, 2022
This is a path for following changes in the Gutenberg plugin:
* [WordPress/gutenberg#42209 #42209: Post Editor: Preload templates post type permissions]
* [WordPress/gutenberg#42413 #42413: Post Editor: Avoid 403 errors for users with low permissions].

Follow-up to [43815], [44172], [46110], [51962], [52995].

Props Mamaduka, bernhard-reiter, TimothyBlynJacobs.
See #56467.

git-svn-id: https://develop.svn.wordpress.org/trunk@54084 602fd350-edb4-49c9-b593-d223f7449a82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor REST API Interaction Related to REST API [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Template Mode: Preload templates OPTIONS
2 participants