[MGNLRESTUI-42] PaginatedJsonDataProvider starting loop, which getting all pages Created: 24/Feb/21  Updated: 01/Mar/21

Status: Open
Project: Magnolia REST Client UI
Component/s: None
Affects Version/s: 1.0.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Stepan Koshechkin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled

 Description   

Steps to reproduce

  1.  Attach a pagination to your jsonDatasource
  2.  Set a breakpoint inside a while loop here 
    info.magnolia.rest.ui.PaginatedJsonDataProvider#fetchFromBackEnd
    
  3. Start scroll a little bit down to switch page

Expected results

Dataprovider fetching only required amount of pages.

Actual results

Dataprovider fetches ALL pages from a datasource

Workaround

Override JsonDataProvider and add this checking

if (definition.getPagination() != null) {
    return jsonNodes;
}

in a filterResponse method

Development notes

Here 

info.magnolia.rest.ui.JsonDataProvider#filterResponse

we have json nodes partitioning, which, I think, shouldn't be performed when pagination is enabled, because in this checking

if (start >= length) {
    return Collections.emptyList();
}

we returning empty list and while loop which mentioned above just can't break until it fetches all pages


Generated at Mon Feb 12 06:51:18 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.