Skip to content

Commit b800bc4

Browse files
committed
fix(stepper): prevent error when setting linear property to true
1 parent 6242015 commit b800bc4

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
@@ -68,6 +68,7 @@ export default class IgcStepperComponent extends EventEmitterMixin<
6868
);
6969

7070
private activeStep!: IgcStepComponent;
71+
private _shouldUpdateLinearState = false;
7172

7273
/** Returns all of the stepper's steps. */
7374
@queryAssignedElements({ selector: 'igc-step' })
@@ -171,6 +172,10 @@ export default class IgcStepperComponent extends EventEmitterMixin<
171172

172173
@watch('linear', { waitUntilFirstUpdate: true })
173174
protected linearChange(): void {
175+
if (!this.activeStep) {
176+
this._shouldUpdateLinearState = true;
177+
return;
178+
}
174179
this.steps.forEach((step: IgcStepComponent) => {
175180
step.linearDisabled = this.linear;
176181
if (step.index <= this.activeStep.index) {
@@ -480,6 +485,10 @@ export default class IgcStepperComponent extends EventEmitterMixin<
480485
}
481486

482487
this.syncProperties();
488+
if (this._shouldUpdateLinearState) {
489+
this.linearChange();
490+
this._shouldUpdateLinearState = false;
491+
}
483492
if (this.linear) {
484493
this.updateStepsLinearDisabled();
485494
}

0 commit comments

Comments
 (0)