Skip to content

Commit 11386aa

Browse files
MonikaKirkovakacheshmarovarkaraivanov
authored
fix(stepper): prevent error when setting linear property to true (#1672)
Co-authored-by: Vasya Kacheshmarova <[email protected]> Co-authored-by: Radoslav Karaivanov <[email protected]>
1 parent ee58209 commit 11386aa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/stepper/stepper.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export default class IgcStepperComponent extends EventEmitterMixin<
6565
);
6666

6767
private activeStep!: IgcStepComponent;
68+
private _shouldUpdateLinearState = false;
6869

6970
/** Returns all of the stepper's steps. */
7071
@queryAssignedElements({ selector: 'igc-step' })
@@ -168,6 +169,10 @@ export default class IgcStepperComponent extends EventEmitterMixin<
168169

169170
@watch('linear', { waitUntilFirstUpdate: true })
170171
protected linearChange(): void {
172+
if (!this.activeStep) {
173+
this._shouldUpdateLinearState = true;
174+
return;
175+
}
171176
this.steps.forEach((step: IgcStepComponent) => {
172177
step.linearDisabled = this.linear;
173178
if (step.index <= this.activeStep.index) {
@@ -482,6 +487,10 @@ export default class IgcStepperComponent extends EventEmitterMixin<
482487
}
483488

484489
this.syncProperties();
490+
if (this._shouldUpdateLinearState) {
491+
this.linearChange();
492+
this._shouldUpdateLinearState = false;
493+
}
485494
if (this.linear) {
486495
this.updateStepsLinearDisabled();
487496
}

0 commit comments

Comments
 (0)