-
Notifications
You must be signed in to change notification settings - Fork 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
(5P) Starter Page Templates: Fetch assets from template before insertion #34839
Conversation
The animated WP logo outline which might be a possible loading state comes from here: https://github.com/WordPress/gutenberg/blob/bb8debab915e9fab373e24f9e9dd9469ac27779a/packages/editor/src/components/post-preview-button/index.js#L19 It's currently embedded with the preview button itself (not sure if good idea) so we can either make some sort of abstraction or copy/paste the svg asset + animation 🤷♂️ |
49b53a4
to
9600707
Compare
9600707
to
9461d8a
Compare
3adb4e9
to
b4647ac
Compare
9461d8a
to
be8440d
Compare
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
9ae3312 makes use of the API endpoint. There are a few things worth discussing and adding to our todo list:
|
I'm affright this might not be possible - that's why I've started this by delaying the insertion. Once the blocks are inserted, any other change will create an entry in the
I have mentioned using postmeta for this in the other PR. Sounds like a good optimisation to do. You should see my media library on the site I test this PR with :D
Maybe we can simplify it to just accept image URLs? It could route requests on its own to the right place. |
I've build a support for a loading state but I haven't done anything in the UI. Let's do it as a separate task. State already has all the info required so minimal code to do it would be something like this:
(Written to be somewhere in the |
Regarding the time it takes to import images - let's make sure we optimize images in our templates - jpg, appropriate resolution and compression. The timing might be a pain point at this moment as inserting the template is the only way to preview it but if we make better previews in-modal, I think it wouldn't be that big of an issue. |
@youknowriad @mtias Is there any way you can think of where we could replace images after the template has been inserted, without adding to the |
|
6f3bcf9
to
cd51599
Compare
I just tested it with D31446-code to use the optimized and smaller images, and it's still an excruciatingly long wait time after selecting a template. For the portfolio template the sideloading request alone took 10.46s. I don't know if the work on large previews could help us soften that blow somehow, but for now it just simply takes too long :( |
Have you tested on the sandbox or locally? I just did some more testing on my sandbox and noticed bugs that I'll need to address. The main one is that on wpcom all requests go through the common API proxy and somehow we have double slash there which prevents it from working. Example URL: https://public-api.wordpress.com/wp/v2/sites/112010505//fse/v1/sideload/image/batch?_envelope=1&_locale=user |
I created D31603 as a fix for the API endpoint on dotcom |
I started on Friday and have a WIP locally. Still a ton to update, the changes are significant… |
Yeah, that's true. |
cd51599
to
fdf6504
Compare
<Spinner /> | ||
{ __( 'Inserting template…', 'full-site-editing' ) } | ||
</div> | ||
) : ( |
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.
Anytime I come across this, I wonder if it may be time to separate it out into a function.
fdf6504
to
27fdab5
Compare
This feature is now controlled through this prop: https://github.com/Automattic/wp-calypso/pull/34839/files#diff-a664d83ace51cb87304bf656c9e9f303R244 disabled by default so we can merge the code and evolve it while keeping the old behavior |
Changes proposed in this Pull Request
New flow after selecting a template:
TODO:
core/cover
core/gallery
blockscore/media-text
blocks?w=640
)Testing instructions
Install plugin on your WP, following https://github.com/Automattic/wp-calypso/blob/master/apps/full-site-editing/README.md
POST /wp-json/fse/v1/batch
)Fixes #34603
Fixes #34570