The app.store.find() method doesn't handle API response pagination

Open
#4,234 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
api, frontend

Research direction

Start at the app.store.find() entry point and reproduce the issue with a request exceeding the server's pagination limit. Inspect the API response pagination data and existing store-related tests, if present; done means the find operation makes all relevant pages available in the store rather than only the first response.

Written by the indexing model from the issue text.

Description

type/bug
Current Behavior

Only the first response from the server is used; pagination is ignored. This is not intuitive, as a calling user would expect that all results are pushed to the store, not only the first page.

Steps to Reproduce

Request a larger batch of users than the pagination limit:

app.store.find('users', [1,2,3,...], {
          include: 'groups'
        });
Expected Behavior

The find method should honor pagination.

Screenshots
Image Image
Environment

Flarum: 1.8.10
PHP: 8.3.22
MySQL: 10.5.29-MariaDB-ubu2004
Queue Driver: sync
Session Driver: file

Output of php flarum info
Flarum core: 1.8.10
PHP version: 8.3.22
MySQL version: 10.5.29-MariaDB-ubu2004
Loaded extensions: Core, date, libxml, pcre, zlib, filter, hash, json, random, readline, Reflection, SPL, session, ctype, curl, dom, fileinfo, gd, gmp, iconv, intl, mbstring, openssl, PDO, standard, SimpleXML, sodium, tokenizer, xml, xmlwriter, zip, exif, mysqlnd, Phar, pdo_mysql, uuid, imagick, Zend OPcache
+----------------------+----------+--------+
| Flarum Extensions    |          |        |
+----------------------+----------+--------+
| ID                   | Version  | Commit |
+----------------------+----------+--------+
| flarum-flags         | v1.8.2   |        |
| flarum-approval      | v1.8.2   |        |
| flarum-tags          | v1.8.4   |        |
| lemonn-user-map       | dev-main |        |
| flarum-suspend       | v1.8.4   |        |
| flarum-subscriptions | v1.8.1   |        |
| flarum-sticky        | v1.8.2   |        |
| flarum-statistics    | v1.8.1   |        |
| flarum-mentions      | v1.8.5   |        |
| flarum-markdown      | v1.8.1   |        |
| flarum-lock          | v1.8.2   |        |
| flarum-likes         | v1.8.1   |        |
| flarum-lang-english  | v1.8.0   |        |
| flarum-emoji         | v1.8.1   |        |
| flarum-bbcode        | v1.8.0   |        |
+----------------------+----------+--------+
Base URL: http://192.168.178.79:8000
Installation path: /opt/flarum
Queue driver: sync
Session driver: file
Mail driver: mail
Debug mode: ON

Possible Solution

No response

Additional Context

No response

Dominant language
PHP
Stars
6.8k
Forks
891
Avg merge
1d 10h
Merged PRs (30d)
209

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from flarum/framework

All issues in flarum/framework

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.