-
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
Inserter: Try improving pattern loading #64376
base: trunk
Are you sure you want to change the base?
Conversation
I think the main issue I see here is that we don't really know where the requests are triggered. Ideally, if a pattern is ready it should render and not wait for all the other patterns to load. Is that something we can account for? |
Size Change: +166 B (+0.01%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
While working on #64401, I also noticed that the Patterns endpoint, isn't preloaded. The post types endpoint supports unbound queries ( Not sure if info is helpful here, but decided to share it anyways 😄 |
Yes, this is a naive approach which doesn't account for any pattern that's ready - instead we reveal them all together. We don't really have a good mechanism to differentiate the requests per pattern, which makes your proposal difficult to achieve. One way to work around that would be to add an API to |
@Mamaduka thanks, but I don't really think we need to preload the patterns. They will load as soon as when you open the inserter, which makes sense to me. After all, a user might never need to open the inserter in a session, and therefore they might never need the patterns, so preloading them seems like overkill. Also, for the post editor, we're loading them as part of the initial loading process: gutenberg/packages/editor/src/components/provider/use-block-editor-settings.js Lines 292 to 299 in dd31d29
|
Then, I think we should remove it from the preload path list. It doesn't work, and folks could make incorrect assumptions based on it. I'll create a PR for it. Thanks, @tyxla! |
Well, that makes sense to me. I'd love to explore why we added that preloading in the first place before removing it, and your PR will be a good motivation to understand that. Thanks @Mamaduka 🙌 |
What?
We're experimenting with concealing the pattern loading sequence so pattern previews are displayed when ready.
This is a rather unfinished experiment, and it's not ready to be merged.
Why?
Currently, pattern previews will render multiple different temporary states until fully loaded. This causes jumping and clunkiness, which, ideally, the user shouldn't see.
See #44750 for more information.
How?
Considering that patterns are usually accessed after the editor loads, we rely on tracking currently resolving requests, and if there are any, we consider they're querying data needed to render the patterns. We're doing some visual modifications and rendering a spinner while loading.
Testing Instructions
Testing Instructions for Keyboard
None
Screenshots or screencast
Before:
Screen.Recording.2024-08-08.at.16.37.46.mov
After:
Screen.Recording.2024-08-08.at.16.25.30.mov