Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-6229

Allow DataProvider to handle hasChildren method

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 6.2.4
    • 6.2.3
    • None
    • None

      Background

      In S3 external dam we have an issue displaying the asset tree for the first time. When there are many buckets (parent folders), it takes a very long time to render the tree for the first time. Then the assets are cached and we don’t have this issue anymore. Also opening other folders have no problem.

      The main problem is vaadin needs to know whether each parent folder has children or not. To do so, vaadin calls sequentially the hasChildren method in the corresponding HierarchicalDataProvider for the view. In our case info.magnolia.ui.contentapp.FilterableHierarchicalDataProvider implements the hasChildren:

      public boolean hasChildren(T item) {
          return fetchChildren(new HierarchicalQuery<>(filter, item)).count() > 0;
      }

      This is always translated into a remote API call. As we are able to know in advance whether a bucket has children or not, we would like to override this method to avoid all these remote API calls. Unfortunately we can’t, as FilterableHierarchicalDataProvider has a private constructor.

      Proposed solution

      Remove the hasChildren method from info.magnolia.ui.contentapp.FilterableHierarchicalDataProvider so instead we would use the parent (HierarchicalDataProviderWrapper) implementation:

      public boolean hasChildren(T item) {
          return dataProvider().hasChildren(item);
      }

      This would allow to override the implementation appropriately.

        Acceptance criteria

              jalonso Jesus Alonso
              jalonso Jesus Alonso
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoR