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

Unbounded queries #2661

Open
Tracked by #3005
fluiddot opened this issue Sep 23, 2020 · 3 comments
Open
Tracked by #3005

Unbounded queries #2661

fluiddot opened this issue Sep 23, 2020 · 3 comments
Labels
[Type] Enhancement Improves a current area of the editor

Comments

@fluiddot
Copy link
Contributor

fluiddot commented Sep 23, 2020

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.

@guarani guarani added the [Type] Enhancement Improves a current area of the editor label Sep 23, 2020
@hypest hypest added this to Triage in Mobile Gutenberg via automation Sep 24, 2020
@hypest hypest moved this from Triage to Backlog (unscheduled/unassigned) in Mobile Gutenberg Sep 24, 2020
@fluiddot
Copy link
Contributor Author

fluiddot commented Mar 9, 2021

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
Copy link
Contributor Author

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.

SiobhyB added a commit to WordPress/gutenberg that referenced this issue May 9, 2022
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.
@SiobhyB
Copy link
Contributor

SiobhyB commented May 10, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement Improves a current area of the editor
Projects
Mobile Gutenberg
  
Backlog (unscheduled/unassigned)
Development

No branches or pull requests

3 participants