-
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
Gallery Block: Get media data in a single request #34389
Conversation
@glendaviesnz, Unless I'm misreading logic in |
Size Change: -607 B (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
Thanks for looking into this @Mamaduka. I got really excited about 6 months ago when I discovered the I did play around with trying to page the results to groups of 100 for galleries > 100, but that caused a lot of weird issues that I couldn't resolve at the time. But, you may have some thoughts on how to effectively page these calls. |
Thanks for the feedback, @glendaviesnz. Interestingly, most of the entities support I'm not sure if this was intentional or overlooked, but I will try to find out. |
@glendaviesnz created the PR to fix the issue with |
9e51ff6
to
7755d06
Compare
Hi, @glendaviesnz I just merged #34417 today. Should I move forward with this PR? |
Yes, definitely worth switching this to the |
Thanks for the enhancement! I'll test the mobile side of this. It looks like this will be a great improvement there as well 👍 |
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.
This tested well for me. In a gallery with 250 images it took the requests to /wp/v2/media
endpoint down from 250 to 2 requests, and the image size selector loading as expected.
Thanks for testing and review, @glendaviesnz. @mkevins, let me know when you get the chance to test the mobile side of this enhancement. |
Hi @Mamaduka 👋 😄 I actually tried to get to this earlier this week, but ran into other issues (unrelated with this PR) which prevented me from testing this. We are currently debugging an issue (potentially a cache issue) with the flag which enables the refactored gallery. My apologies for the unexpected delay. |
@mkevins, no worries 👍 |
I have to admit that using |
@aristath, what do you think about using |
Ah I missed the fact that there's an |
Hi @Mamaduka 👋 😄 I was able to test this, and inspecting the requests in the profiler confirms that this reduces the number of requests for mobile as well! Nice work 👍 |
Description
With recent Gallery block refactoring now, it's possible to request media data in a single call instead of N numbers of requests.
The small downside of this change is that it will fire a new request when a gallery item (Image block) is selected. But I think this still improves the initial load of image data.
Fixes #10994.
How has this been tested?
Types of changes
Enhancement
Checklist:
*.native.js
files for terms that need renaming or removal).