-
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
Site Editor: Templates Reconciliation Performance #25868
Comments
I'm happy to take this since I introduced this feature 😄 I think the most straightforward solution is to only reconcile the template and template parts when the
I'd also add one more to the basket: reconcile when the site editor is opened. This is required to make sure that whenever the user makes changes to the HTML files or create new ones, they are reconciled. Since the child theme where the user add/update these files aren't going to be "updated". This request can run in the background without affecting anything on the site editor. What do you think? |
There is another possible case, probably not very common: users can manually modify the theme files without releasing a full theme update. So: the three reconciliation cases you mentioned should be plenty enough to cover wp-admin. E.g.
|
If they are the same priority (eg. you created a
The one with the higher priority. If you had a |
Got it. |
Just to clarify, when you say "theme installed" do you mean "theme activated?" Furthermore, if you do mean "theme activated," should the reconciliation take place on the same auto-draft from the previously active theme, or should a new auto-draft be created for the new theme? I'm hoping the former, as it would avoid polluting the database, as long as there are no side effects. |
@carlomanf Yes, I mean activated. Corrected it in my comment. |
In #25739 we merged an update to the templates handling that could affect the Site Editor performance on sites with many templates and template parts.
(cc @epiqueras who worked on this and might have a deeper knowledge of the whole logic.)
Template Reconciliation
Templates (and template parts) can be both provided by the theme as HTML files, or by the site as
wp_template
(andwp_template_part
) posts.Since there isn't a single source of truth, they need to be reconciled every now and then.
When the reconciliation happens:
publish
(meaning: it has been modified and saved by the user), we don't need to reconcile.auto-draft
(meaning: it is a direct copy from the original template file), we compare it with the template file, check if the content has been changed, and update the template post if needed.auto-draft
using the template file as content.This reconciliation happens by filtering
rest_wp_template_query
(andrest_wp_template_part_query
), which runs on any REST request onwp_template
(andwp_template_part
).Before #25739, we only reconciled the requested template or template part.
Now, we reconcile all templates and template parts.
Audit
If the site has a lot of templates, this might become very performance intensive.
Let's check what kind of performance impact this have, and address it as much as we can.
Chances are that we don't really need to reconcile all templates so often.
The text was updated successfully, but these errors were encountered: