gutenberg-mobile icon indicating copy to clipboard operation
gutenberg-mobile copied to clipboard

Unbounded queries

Open fluiddot opened this issue 5 years ago • 3 comments
trafficstars

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 middleware fetch-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.

fluiddot avatar Sep 23 '20 17:09 fluiddot

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.

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).

fluiddot avatar Mar 09 '21 09:03 fluiddot

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.

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.

fluiddot avatar Mar 17 '21 11:03 fluiddot

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 https://github.com/WordPress/gutenberg/pull/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.

SiobhyB avatar May 10 '22 09:05 SiobhyB