Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit 14ec2f4

Browse files
jbdeboernshahan
authored andcommitted
Update state and call markForCheck in the same microtask.
This ensures Angular always has a consistent view of the component's state. PiperOrigin-RevId: 243334618
1 parent 7b72422 commit 14ec2f4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

angular_components/lib/material_progress/material_progress.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,12 @@ class MaterialProgressComponent implements AfterViewInit, OnDestroy {
158158
// Fall back to the non-optimized animation if the host element does not
159159
// yet have a width. The non-optimized animation will automatically adjust
160160
// when the host element width changes.
161-
_useFancyAnimation = false;
162161

163162
// To avoid 'expression has changed after it was checked'.
164-
scheduleMicrotask(_changeDetector.markForCheck);
163+
scheduleMicrotask(() {
164+
_useFancyAnimation = false;
165+
_changeDetector.markForCheck();
166+
});
165167
return;
166168
}
167169

0 commit comments

Comments
 (0)