diff --git a/.changeset/plenty-pears-add.md b/.changeset/plenty-pears-add.md new file mode 100644 index 000000000..3e60ace1a --- /dev/null +++ b/.changeset/plenty-pears-add.md @@ -0,0 +1,5 @@ +--- +"bits-ui": patch +--- + +fix(Pagination): call `onPageChange` _after_ setting the `page` diff --git a/packages/bits-ui/src/lib/bits/pagination/components/pagination.svelte b/packages/bits-ui/src/lib/bits/pagination/components/pagination.svelte index 01cd609e8..14e872182 100644 --- a/packages/bits-ui/src/lib/bits/pagination/components/pagination.svelte +++ b/packages/bits-ui/src/lib/bits/pagination/components/pagination.svelte @@ -25,8 +25,8 @@ defaultPage: page, onPageChange: ({ next }) => { if (page !== next) { - onPageChange?.(next); page = next; + onPageChange?.(next); } return next;