Uploaded image for project: 'Magnolia REST Client UI'
  1. Magnolia REST Client UI
  2. MGNLRESTUI-42

PaginatedJsonDataProvider starting loop, which getting all pages

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 1.0.2
    • None

    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

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              skoshechkin Stepan Koshechkin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Bug DoR
                  Task DoD