From 158803d002fe3f3b99fa5e93cb65fb840cdbdf7d Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Tue, 7 Oct 2025 13:00:55 +0530 Subject: [PATCH 1/2] QE-1993 fix type error --- src/slider/tp-slider.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/slider/tp-slider.ts b/src/slider/tp-slider.ts index a5fa1ac..aef7751 100644 --- a/src/slider/tp-slider.ts +++ b/src/slider/tp-slider.ts @@ -397,13 +397,19 @@ export class TPSliderElement extends HTMLElement { * Update stuff when any attribute has changed. * Example: Update sub-components. */ - update(): void { + async update(): Promise { // Get sub-components. const sliderNav: TPSliderNavElement | null = this.querySelector( 'tp-slider-nav' ); const sliderCounts: NodeListOf | null = this.querySelectorAll( 'tp-slider-count' ); const leftArrow: TPSliderArrowElement | null = this.getArrow( 'tp-slider-arrow[direction="previous"]' ); const rightArrow: TPSliderArrowElement | null = this.getArrow( 'tp-slider-arrow[direction="next"]' ); + // Wait for initialization - done to avoid updateNavItems undefined error. + await customElements.whenDefined( 'tp-slider-nav' ); + await customElements.whenDefined( 'tp-slider-nav-item' ); + await customElements.whenDefined( 'tp-slider-count' ); + await customElements.whenDefined( 'tp-slider-arrow' ); + // Total slides variable and Total posible group. const totalSlides: number = this.getTotalSlides(); const totalPosibleGroups: number = Math.ceil( totalSlides / this.step ); From 7849c4c2c2b96d1b5c032278ee8ff9fc661f5a18 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Tue, 7 Oct 2025 13:01:45 +0530 Subject: [PATCH 2/2] QE-1993 fix typo --- src/slider/tp-slider.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/slider/tp-slider.ts b/src/slider/tp-slider.ts index aef7751..819ea94 100644 --- a/src/slider/tp-slider.ts +++ b/src/slider/tp-slider.ts @@ -254,8 +254,8 @@ export class TPSliderElement extends HTMLElement { // Initialize total slides variable. const totalSlides: number = this.getTotalSlides(); - // Total Posible groups. - const totalPosibleGroups: number = Math.ceil( totalSlides / this.step ); + // Total Possible groups. + const totalPossibleGroups: number = Math.ceil( totalSlides / this.step ); // Initialize previous slide number. let previousSlideNumber: number = 0; @@ -267,13 +267,13 @@ export class TPSliderElement extends HTMLElement { // Check if we are in the last group or in any other. if ( this.currentSlideIndex + this.step - 1 >= totalSlides ) { - currentGroup = totalPosibleGroups; + currentGroup = totalPossibleGroups; } else { currentGroup = Math.ceil( this.currentSlideIndex / this.step ); } // Update previous slide number based on which group we are in. - if ( currentGroup === totalPosibleGroups ) { + if ( currentGroup === totalPossibleGroups ) { previousSlideNumber = this.currentSlideIndex - this.step + 1; } else { previousSlideNumber = this.currentSlideIndex - this.step; @@ -410,9 +410,9 @@ export class TPSliderElement extends HTMLElement { await customElements.whenDefined( 'tp-slider-count' ); await customElements.whenDefined( 'tp-slider-arrow' ); - // Total slides variable and Total posible group. + // Total slides variable and Total possible group. const totalSlides: number = this.getTotalSlides(); - const totalPosibleGroups: number = Math.ceil( totalSlides / this.step ); + const totalPossibleGroups: number = Math.ceil( totalSlides / this.step ); // Set active slide. const slides: NodeListOf | null | undefined = this.getSlideElements(); @@ -448,7 +448,7 @@ export class TPSliderElement extends HTMLElement { // Check if index and groups are equal to update active dot. if ( groupIndex === index ) { navItem.setAttribute( 'current', 'yes' ); - } else if ( ( index === totalPosibleGroups - 1 && this.currentSlideIndex + this.step - 1 >= totalSlides ) ) { + } else if ( ( index === totalPossibleGroups - 1 && this.currentSlideIndex + this.step - 1 >= totalSlides ) ) { navItem.setAttribute( 'current', 'yes' ); // Remove current index from last 2nd item.