Skip to content
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

Updates to Gallery block not saved because of - 400 failed to load resource error - if more than 100 images are in gallery #46088

Closed
wddean opened this issue Nov 26, 2022 · 4 comments · Fixed by #46143
Assignees
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Type] Bug An existing feature does not function as intended

Comments

@wddean
Copy link

wddean commented Nov 26, 2022

If over 100 images are added to a Gallery block the "Image Size" setting never finishes loading ( the loading indicator spins indefinately and reads "Loading options...".

DevTools console shows the following error:
"Failed to load resource: the server responded with a status of 400 ()"

{"code":"rest_invalid_param","message":"Invalid parameter(s): per_page","data":{"status":400,"params":{"per_page":"per_page must be between 1 (inclusive) and 100 (inclusive)"},"details":{"per_page":{"code":"rest_out_of_bounds","message":"per_page must be between 1 (inclusive) and 100 (inclusive)","data":null}}}}

If a change is made to the "Link To" setting for the gallery this update is not saved. For example if "Link To" is updated to "Media File" images are not linked to their media file.

The error goes away and the "Image Size" setting finishes spinning and loads if there are 100 or fewer images in the gallery but just clicking update to apply the "LInk To" setting doesn't work. You first must change it to something else such as "Attachment Page" and then change it back to "Media File" and click update and then the Media file links get applied to all images.

@Mamaduka Mamaduka added Needs Testing Needs further testing to be confirmed. [Block] Gallery Affects the Gallery Block - used to display groups of images labels Nov 28, 2022
@glendaviesnz
Copy link
Contributor

glendaviesnz commented Nov 28, 2022

I was able to replicate this by adding a gallery with > 100 images. @SiobhyB this is caused by this change. With this change the call to get the media info fails if a page size of > 100 is set. @Mamaduka any thoughts on ways around this, as the previous alternative of -1 also caused some concerns?

@glendaviesnz glendaviesnz added [Type] Bug An existing feature does not function as intended and removed Needs Testing Needs further testing to be confirmed. labels Nov 28, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 29, 2022
@Mamaduka
Copy link
Member

It's okay to use an unbound query for web versions. The results are limited by the include parameter.

@SiobhyB
Copy link
Contributor

SiobhyB commented Nov 29, 2022

Thank you for the ping @glendaviesnz! As a native-specific version of the use-get-media.js file has been introduced since I made that change, the unbounded query can be restored to the web file (which I see has already been proposed in #46143) without impacting native. I'll also do some testing to see whether the issue with saving the Gallery block can be replicated on native and follow up accordingly. Appreciate the heads up 🙇‍♀️

@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Nov 30, 2022
@SiobhyB
Copy link
Contributor

SiobhyB commented Dec 1, 2022

To tie up any loose ends: I finished testing this on native and am happy to report that the issues with 100+ images aren't reproducible there. I tested on both platforms with posts that have 100+ images uploaded across multiple blocks as well as posts that have a single gallery block with 100+ images. I was still able to save and make changes in those posts, without error, though the performance was noticeably slow. I don't think there are any further native-specific issues that need to be created here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Gallery Affects the Gallery Block - used to display groups of images [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants