Skip to content

[Bug]: Cannot update usePagination totalItemsΒ #3120

@giorgiopogliani

Description

@giorgiopogliani

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/vue@2.6.2

Framework

Nuxt 3

Node version

21

Browser

Chrome

OS

Mac OS

Relevant log output

No response

Able to fix / change the documentation?

  • Yes
  • No

Code of Conduct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions