Skip to content

Commit d908c9f

Browse files
manzonifjelbourn
authored andcommitted
fix(cdk/virtual-scroll): run changeDetection after computing transform (#17727)
1 parent 86a4208 commit d908c9f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/cdk/scrolling/virtual-scroll-viewport.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,15 +390,15 @@ export class CdkVirtualScrollViewport extends CdkScrollable implements OnInit, O
390390
private _doChangeDetection() {
391391
this._isChangeDetectionPending = false;
392392

393-
// Apply changes to Angular bindings. Note: We must call `markForCheck` to run change detection
394-
// from the root, since the repeated items are content projected in. Calling `detectChanges`
395-
// instead does not properly check the projected content.
396-
this.ngZone.run(() => this._changeDetectorRef.markForCheck());
397393
// Apply the content transform. The transform can't be set via an Angular binding because
398394
// bypassSecurityTrustStyle is banned in Google. However the value is safe, it's composed of
399395
// string literals, a variable that can only be 'X' or 'Y', and user input that is run through
400396
// the `Number` function first to coerce it to a numeric value.
401397
this._contentWrapper.nativeElement.style.transform = this._renderedContentTransform;
398+
// Apply changes to Angular bindings. Note: We must call `markForCheck` to run change detection
399+
// from the root, since the repeated items are content projected in. Calling `detectChanges`
400+
// instead does not properly check the projected content.
401+
this.ngZone.run(() => this._changeDetectorRef.markForCheck());
402402

403403
const runAfterChangeDetection = this._runAfterChangeDetection;
404404
this._runAfterChangeDetection = [];

0 commit comments

Comments
 (0)