Gallery: Use unbound query when fetching image details#46143
Conversation
|
Size Change: 0 B Total Size: 1.32 MB ℹ️ View Unchanged
|
SiobhyB
left a comment
There was a problem hiding this comment.
Thanks for working to resolve this @Mamaduka!
I also replaced the per_page=-1 parameter used in use-short-code-transform.js as part of #40947, will that need to be updated for the web too?
it might be a good idea to leave an inline note in the native file regarding the limitation.
Agreed, I will first do some testing to double-check what happens when a post with 100+ images is saved on mobile. If updates aren't being saved, as in #46088, there may be more changes needed. I'll follow up in a separate PR.
SiobhyB
left a comment
There was a problem hiding this comment.
Great, thanks for confirming! This looks good to me from the native-side. I'll follow up with any native-specific issues separately after further testing, but don't want to block the web fix.
|
I will merge the fix, considering it restores the previous behavior for the web variant. |
|
@Mamaduka, I've 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 therefore think the only follow up we need to do on the native-side is to add the clarifying inline comment, as per your suggestion. I've gone ahead to open a small PR for this in #46245 and have requested your review. Thanks! |
What?
Fixes #46088.
PR restores the
getMediaItemsselector to use unbound query and avoid errors when the Gallery has more than 100 images.Why?
The core REST APIs have a
per_pagelimit of 100. The block editor works around this limitation usingfetchAllMiddlewareto handle unbound queries. Unfortunately, this method isn't supported on the native side, and we had to set a "hard" limit for the query. See #40947.How?
Now that there's a native variant of
useGetMedia(#42178), I restored the previous query parameters in the web variant.@geriux, @SiobhyB, it might be a good idea to leave an inline note in the native file regarding the limitation.
Testing Instructions