Problem/Motivation

While working on #3314975: Add radio buttons widget and #3315187: Add select list widget, we noticed it is confusing when the API returns more than 50 results.
Only the first 50 are displayed in the widget.

Steps to reproduce

Add a jsonapi_reference field with a select widget referencing a taxonomy with more than 50 terms.
Only the first 50 terms are displayed in the widget

Proposed resolution

JsonApiClient::search() should loop on every page of results.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

prudloff created an issue. See original summary.

prudloff’s picture

Status: Active » Needs review

Here is a basic implementation.
However, it assumes you're not using this on a query with thousands of results.

eli-t’s picture

I think this idea makes sense ❤️

I think we'd have to make such pagination through the results optional though; on a large dataset when using the autocomplete widget, this would lead to a worse user experience; you would have to wait far longer for a response, and if you're getting more than 50 results for an autocomplete, another 50 aren't going to be helpful.

prudloff’s picture

Indeed, I think it only makes sense for some widgets and if the dataset is not too huge.