Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImage Block: Improve performance by only requesting image metadata if selected. #17504
Conversation
… selected.
Hi @epiqueras, checking the code it seems that the image object is only needed to select an image size |
I don't think that's worth the extra complexity. What if we need it in other places as well? Making the request once selected is perfectly fine from a performance standpoint. |
Doesn't what @jorgefilipecosta proposes aligns closely with the principles we shared when building components? I didn't look inside the code, but I think it makes a lot of sense to use data in components which consume it rather than pass it down from the |
Yeah, but this component is already implemented and the fix is 2 lines. Breaking it into components is almost a complete refactor and shouldn't be tied to this fix. |
I verified this fix works well, I guess breaking the big edit in components would be positive but I agree with @epiqueras it is something we can look after and not as part of this fix. |
… selected. (WordPress#17504)
epiqueras commentedSep 20, 2019
Fixes #17465
Description
This PR stops image blocks from preemptively requesting image metadata and delays it until the block is selected.
This fixes performance issues with posts that contain many images.
How to test?
Verify that the image block still works as expected and that the issue described in #17465 is no longer happening.
Checklist: