Skip to content

Support for dynamic pagination size on collectionManager #212

@JSicardiNC

Description

@JSicardiNC

I was trying to use the collectionManager on a Vue3 project to create a collection that can be called multiple times with different page size. For that, i tried to define my collection like exporting the pagination object, a common practice seen in other project when using filters, to change the value of the filters on a view before doing collection.refresh().
Somehow, the collection seems to not take the change of size in pagination properly. My first refresh was executed with the updated pageSize value, but all the other ones used the same value, ignoring the new definition before calling refresh again. The library seems to have some issues supporting this type of dynamic pagination with pageSize changing.

This issue can be discarded as a wrong use of the library, but i wanted to create it anyway to check if it's a bug or rather a wrong use of collection library

Full example can be seen on FansForumPR.
I will add some pseudo-code to show the example:

api.ts file:
export const modelFunctions = () => { const modelFilters = { premium: false, } const modelPagination = new Pagination({ size: 10 }) const modelCollection = createCollectionManager({ fetchList: modelApi.list, filters: modelFilters, pagination: modelPagination, }) return { modelCollection, modelFilters, modelPagination, } }

By updating the property size for modelPagination in a view, it only works sometimes, proving to not take into consideration future updates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions