Flowpack.Listable icon indicating copy to clipboard operation
Flowpack.Listable copied to clipboard

Mention in documentation that collections cannot be passed with props to PaginatedCollection

Open klfman opened this issue 2 years ago • 0 comments

Flowpack.Listable:PaginatedCollection has a collection key that must be set by the user.

The documentation shows an example:

prototype(My.Custom:Object) < prototype(Flowpack.Listable:PaginatedCollection) {
  collection = ${Search.query(site).nodeType('Something.Custom:Here').sortDesc('date')}
  ...
}

When passing the same search query as prop, it does not work:

prototype(My.Custom:Object) < prototype(Neos.Fusion:Component) {
  collection = ${Search.query(site).nodeType('Something.Custom:Here').sortDesc('date')}
  
  renderer = Flowpack.Listable:PaginatedCollection {
    collection=${props.collection}
  }
}

It was hard to find out and took me several hours of debugging to realize that this is simply not possible because of the caching configuration of PaginatedCollection, because the data passed is not saved with the cache entry (see @cache.context).

I'm not sure where exactly, but might it be worth mentioning this in the README or in the code of the fusion component itself?

klfman avatar Feb 09 '23 14:02 klfman