-
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
Pre-load REST API index data to avoid FOMD #6434
Conversation
Because `theme_supports` data present in the index is used in rendering UI, it'd be better to include it in the initial payload, instead of incurring a second API request. FOMD = Flash of Missing Data
It seems like this causes the schema to be loaded twice: can the current schema usage be reworked to use the data preloaded from |
I'm not sure I follow. Can you clarify? |
I noticed this in #6301, but I thought it was reasonable for this to be loaded asynchronously, particularly because we're doing a union with the current post's format (known/visible/selected at load-time)†. I don't have a strong opposition to preloading it, though it speaks to a broader question of whether there's a line to be drawn for what should and shouldn't be preloaded. Or preload all the things? † Only discussing current post formats usage. Other future usage could be more disruptive without preloading. |
I'd think it would be of benefit to preload all data that will be present in the view. The data is going to be fetched anyway, and this would reduce the real-world overhead (which is loading WordPress again and again to serve API requests). |
In To reproduce, load Gutenberg, View Source, and search for |
Ah, but then we'd need to get this data into the store. Or, we could reference the global variable. The former seems much more desirable to the latter. Any opinions on how to reconcile this difference? |
The schema data is only used here, that I'm aware of, so it should just be a case of loading it from the |
@pento Given the uncertainty around a better approach, can we land this and then open an issue to improve upon it in the future? |
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, let's go with this for now.
@danielbachhuber: Could you please open a new issue to track the problem of /
being loaded twice?
Yep #6539 |
Because
theme_supports
data present in the index is used in renderingUI, it'd be better to include it in the initial payload, instead of
incurring a second API request.
FOMD = Flash of Missing Data
Previously #6318 (comment)