storefront-ui icon indicating copy to clipboard operation
storefront-ui copied to clipboard

[Bug]: Cannot update usePagination totalItems

Open giorgiopogliani opened this issue 1 year ago • 0 comments

Describe the Bug

I am passing props to this component https://docs.storefrontui.io/v2/vue/blocks/pagination

const props = defineProps<{ totalItems: number; currentPage:number; pageSize: number }>();

The component doesn't update the totalItems of course, because vue doesn't always rerender component. The composable doesn't have a method to update it tho, and I cannot pass computed ref as arguments of the composables. There is only setPage but is not enough.

How am I supposed to use this composable?

Expected behavior

A method or something to update the totalItems or be able to pass computed refs, so that the composable can react the props changing.

Steps to reproduce

  • Add the Pagination component to a page
  • pass the props to the component
  • update the totalItems, in real world this would mean fetch new products or something
  • the pagination buttons are not updating

SFUI version

@storefront-ui/[email protected]

Framework

Nuxt 3

Node version

21

Browser

Chrome

OS

Mac OS

Relevant log output

No response

Able to fix / change the documentation?

  • [ ] Yes
  • [X] No

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

giorgiopogliani avatar Apr 23 '24 09:04 giorgiopogliani