-
Notifications
You must be signed in to change notification settings - Fork 58
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
Unbounded queries #2661
Comments
This alternative should be reviewed because on Android it's producing a crash if the site has more than 27 reusable blocks (the crash was fixed in this PR). |
I opened this issue with the insights after investigating further this problem. |
Requests using "per_page=-1" (unbounded queries) are not supported on mobile, as per: wordpress-mobile/gutenberg-mobile#2661 As an unbounded query was being used to fetch inner images in the gallery, the "link to" settings were not working as expected on native. With this commit, the unbounded query is replaced with "imageIds.length" to fix the issue on native.
I came across this issue when looking into broken settings in the Gallery block, which it turned out were caused by an unbounded query (more details in WordPress/gutenberg#40947). That PR also uncovered a small incoming breakage to native, as another unbounded query had been added to code the apps use on the web-side. |
Is your feature request related to a problem? Please describe.
Requests using
per_page=-1
query parameter (Unbounded queries) are not supported on mobile, all requests of this type now fail. If we want to fetch all the items of a resource in the future we would need to support them.I spotted this problem when working on adding support for Reusable blocks to the inserter menu, in this case I needed to fetch all the Reusable blocks of a post for presenting them in the inserter menu.
Describe the solution you'd like
I would like this type of requests to work the same way they do in the web version.
Describe alternatives you've considered
An alternative for now is to fetch the maximum items per page which is
100
but maybe in the future this is not enough, depending on the resource we want to fetch.Additional context
This type of requests are handled by
api-fetch
middlewarefetch-all-middleware
but unfortunately this is the part that is only supported on web.The problem is that this middleware requires the full response object for applying its logic, for example it needs to read the link header to know the next page. As far as I checked, the mobile version of
api-fetch
doesn’t return the full response, it only returns the response’s body so we can’t rely on this logic, which means that we can’t use that query parameter because it raises an exception.The text was updated successfully, but these errors were encountered: