From 53867784ea3b5b1ec6b2677ea4e031de2883e276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz=20=C3=96LKE?= <70342517+olkeoguz@users.noreply.github.com> Date: Thu, 24 Nov 2022 12:26:13 +0300 Subject: [PATCH] fix(pagination): throw events only on page & total-items changes (#326) --- src/components/pagination/bl-pagination.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/pagination/bl-pagination.ts b/src/components/pagination/bl-pagination.ts index 380a8637..90a7119d 100644 --- a/src/components/pagination/bl-pagination.ts +++ b/src/components/pagination/bl-pagination.ts @@ -89,7 +89,11 @@ export default class BlPagination extends LitElement { /** * Fires when the current page changes */ - @event('bl-change') private onChange: EventDispatcher<{ selectedPage: number; prevPage: number; itemsPerPage: number }>; + @event('bl-change') private onChange: EventDispatcher<{ + selectedPage: number; + prevPage: number; + itemsPerPage: number; + }>; connectedCallback() { super.connectedCallback(); @@ -111,6 +115,9 @@ export default class BlPagination extends LitElement { changedProperties.has('totalItems') ) { this._paginate(); + } + + if (changedProperties.get('currentPage') || changedProperties.get('itemsPerPage')) { this.onChange({ selectedPage: this.currentPage, prevPage: changedProperties.get('currentPage'),