-
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
Fix issue where gallery block requests all attachments when empty #28621
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
talldan
added
[Type] Bug
An existing feature does not function as intended
[Feature] Media
Anything that impacts the experience of managing media
[Type] Performance
Related to performance efforts
labels
Feb 1, 2021
talldan
added
the
Backport to WP Minor Release
Pull request that needs to be backported to a WordPress minor release
label
Feb 1, 2021
Unfortunately this has missed the window for WordPress 5.7, but I think it'd be a good thing to get into a minor release (5.7.1?). |
Size Change: +20 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
talldan
force-pushed
the
fix/gallery-block-requesting-all-media
branch
from
February 2, 2021 02:09
77c089a
to
aec3e93
Compare
tellthemachines
approved these changes
Feb 3, 2021
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.
Tested and working as expected ✅
tellthemachines
pushed a commit
that referenced
this pull request
Feb 17, 2021
…8621) * Return early from building attachments for galleries * Improve code clarity
tellthemachines
added a commit
that referenced
this pull request
Feb 17, 2021
* Backport #26475 for the 5.6 branch. * Backport #28604. * Revert "Backport #28604." This reverts commit 32784b6. * Backport #26583 to the 5.6 branch. * Commit lock file updates. * Committing lock file differences after updating `browserslist`. * Pin the version of NodeJS in the Compressed Size workflow. * Memoize getEntityRecords to prevent infinite re-renders (#26447) * Fix issue where gallery block requests all attachments when empty (#28621) * Return early from building attachments for galleries * Improve code clarity * Fix link control styles to prevent scrollbar (#27777) * Update package-lock * Update package-lock again Co-authored-by: Jonathan Desrosiers <desrosj@users.noreply.github.com> Co-authored-by: Kai Hao <kevin830726@gmail.com> Co-authored-by: Daniel Richards <daniel.richards@automattic.com> Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
noisysocks
removed
the
Backport to WP Minor Release
Pull request that needs to be backported to a WordPress minor release
label
Apr 6, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Feature] Media
Anything that impacts the experience of managing media
[Type] Bug
An existing feature does not function as intended
[Type] Performance
Related to performance efforts
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #28563.
When opening the media modal from a gallery block that's empty (for example when the block is first added) an HTTP request for all user media was previously and erroneously made.
This request is used to retrieve details of images already added to a gallery, but when a gallery is empty, the lack of a
post__in
property in the request has the side effect of retrieving all users images. The user in #28563 describes this having a massive server performance impact on their site that has lots of images.For the image block, this request was already being skipped, so this PR does the same for the gallery block by improving the already present early return statement.
How has this been tested?
Empty Gallery Block
admin-ajax
requests with the following params:Gallery with images
query-attachments
, but limited to the selected image ids using thepost__in
property in the query.,Empty Image Block
admin-ajax
requests with the following params:Image block with image
query-attachments
, but limited to the selected image id using thepost__in
property in the query.Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: