Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for dynamic pagination size on collectionManager #212

Open
JSicardiNC opened this issue Nov 27, 2024 · 1 comment
Open

Support for dynamic pagination size on collectionManager #212

JSicardiNC opened this issue Nov 27, 2024 · 1 comment

Comments

@JSicardiNC
Copy link

JSicardiNC commented Nov 27, 2024

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.

@paribaker
Copy link
Contributor

Hello, thanks for this note, I believe the change is related to Vue3, you should be able to get it working by wrapping the pagination in a computed property.
That being said we are slowly deprecating the collectionManager in favor of the tanstack set up. Let me know if you want me to walk you through a typical workflow.
https://www.notion.so/thinknimble/TanStack-Vue-with-List-View-8c66fe92769a4168a8ad2cb174de9e85

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants