-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Remove more initial PHP state #23775
Conversation
Size Change: +137 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
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.
Left a few notes. I think that we might be able to drop a few more of the ancillary functions that have been introduced here as replacements for the previous initial state and tackle the problem at a higher level (hopefully):
I think the mechanism that we have in place to get the template for a given page should be relatively stable; we might not even need the extra logic involving show_on_front
/page_on_front
, but maybe we can basically just pass in the /
route and rely on what is already there for template resolution (basically findTemplate
and the related backend 'endpoint' doing all the heavy lifting).
@ockham we do need to know what the post_id is (page_on_front) :) Though I'm not sure, does findTemplate give us that? |
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.
yeah, will do! (wanted to make sure the code was in a good place before modifying them) |
c3d21df
to
f1b2f06
Compare
@ockham, Let me know what you think of the new approach. I added a |
A few unit tests are failing and need updating I think 😅 |
fa51d1a
to
821ced6
Compare
8da55dc
to
0d02191
Compare
Nice, tests are looking good. (Wish I could dismiss stale reviews!) |
) | ||
); | ||
} | ||
add_action( 'rest_api_init', 'register_site_editor_homepage_settings', 10 ); |
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 believe this is adding data to some REST API endpoint. So pinging @TimothyBJacobs for awareness.
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.
Thanks for the ping! Doing this on rest_api_init
should work, but it might be better to do it on init
so it is always a registered setting. We can also safely drop the name
parameter for show_in_rest
. It'll default to the option name.
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.
Nice, I will definitely make those changes.
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.
Description
This PR looks at removing more initial PHP state for the site editor. Since things can be loaded more async now, I shored up many selectors and code paths to make sure they can handle null/undefined values.
This may also set us up more for loading different dynamic pages on the fly.
I will add comments where some of my concerns are.
How has this been tested?
Locally in edit site.
Screenshots
Types of changes
Code quality
Checklist: