Skip to content

Commit a7fe128

Browse files
authored
fix(cdk/stepper): linear updates not reflected in the DOM (#33007)
In #31208 I converted a bunch of the shared stepper state to signals in order to resolve "changed after checked errors". I didn't do it for `linear` which ends up being used in a `computed` and results in the DOM sometimes being out of sync. These changes update `linear` to use signals under the hood. Fixes #32964.
1 parent 7806398 commit a7fe128

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

goldens/cdk/stepper/index.api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
106106
_getFocusIndex(): number | null;
107107
_getStepContentId(i: number): string;
108108
_getStepLabelId(i: number): string;
109-
linear: boolean;
109+
get linear(): boolean;
110+
set linear(value: boolean);
110111
next(): void;
111112
// (undocumented)
112113
static ngAcceptInputType_linear: unknown;

src/cdk/stepper/stepper.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,14 @@ export class CdkStepper implements AfterContentInit, AfterViewInit, OnDestroy {
341341
private _sortedHeaders = new QueryList<CdkStepHeader>();
342342

343343
/** Whether the validity of previous steps should be checked or not. */
344-
@Input({transform: booleanAttribute}) linear: boolean = false;
344+
@Input({transform: booleanAttribute})
345+
get linear(): boolean {
346+
return this._linear();
347+
}
348+
set linear(value: boolean) {
349+
this._linear.set(value);
350+
}
351+
private _linear = signal(false);
345352

346353
/** The index of the selected step. */
347354
@Input({transform: numberAttribute})

0 commit comments

Comments
 (0)