From a9f0905cd343e6d7b2ed46288940167471ecdf50 Mon Sep 17 00:00:00 2001 From: Biruk Haileye Tabor Date: Fri, 25 Apr 2025 09:20:24 +0300 Subject: [PATCH] Fix input counter component rebind Fix input counter component rebind --- src/components/input-counter/index.ts | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/components/input-counter/index.ts b/src/components/input-counter/index.ts index e6715cd49..8fa1ef5d0 100644 --- a/src/components/input-counter/index.ts +++ b/src/components/input-counter/index.ts @@ -197,22 +197,15 @@ export function initInputCounters() { // check if the target element exists if ($targetEl) { - if ( - !instances.instanceExists( - 'InputCounter', - $targetEl.getAttribute('id') - ) - ) { - new InputCounter( - $targetEl as HTMLInputElement, - $incrementEl ? ($incrementEl as HTMLElement) : null, - $decrementEl ? ($decrementEl as HTMLElement) : null, - { - minValue: minValue ? parseInt(minValue) : null, - maxValue: maxValue ? parseInt(maxValue) : null, - } as InputCounterOptions - ); - } + new InputCounter( + $targetEl as HTMLInputElement, + $incrementEl ? ($incrementEl as HTMLElement) : null, + $decrementEl ? ($decrementEl as HTMLElement) : null, + { + minValue: minValue ? parseInt(minValue) : null, + maxValue: maxValue ? parseInt(maxValue) : null, + } as InputCounterOptions + ); } else { console.error( `The target element with id "${targetId}" does not exist. Please check the data-input-counter attribute.`