Skip to content

Commit e739e61

Browse files
karajosephperrott
authored andcommitted
fix: mark virtual scroll viewport queries as static (#15346)
1 parent 33ced72 commit e739e61

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,9 @@ function triggerScroll(viewport: CdkVirtualScrollViewport, offset?: number) {
836836
encapsulation: ViewEncapsulation.None,
837837
})
838838
class FixedSizeVirtualScroll {
839-
@ViewChild(CdkVirtualScrollViewport) viewport: CdkVirtualScrollViewport;
839+
@ViewChild(CdkVirtualScrollViewport, {static: true}) viewport: CdkVirtualScrollViewport;
840840
// Casting virtualForOf as any so we can spy on private methods
841-
@ViewChild(CdkVirtualForOf) virtualForOf: any;
841+
@ViewChild(CdkVirtualForOf, {static: true}) virtualForOf: any;
842842

843843
@Input() orientation = 'vertical';
844844
@Input() viewportSize = 200;
@@ -888,7 +888,7 @@ class FixedSizeVirtualScroll {
888888
encapsulation: ViewEncapsulation.None,
889889
})
890890
class FixedSizeVirtualScrollWithRtlDirection {
891-
@ViewChild(CdkVirtualScrollViewport) viewport: CdkVirtualScrollViewport;
891+
@ViewChild(CdkVirtualScrollViewport, {static: true}) viewport: CdkVirtualScrollViewport;
892892

893893
@Input() orientation = 'vertical';
894894
@Input() viewportSize = 200;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class CdkVirtualScrollViewport extends CdkScrollable implements OnInit, O
8484
Promise.resolve().then(() => this.ngZone.run(() => observer.next(index)))));
8585

8686
/** The element that wraps the rendered content. */
87-
@ViewChild('contentWrapper') _contentWrapper: ElementRef<HTMLElement>;
87+
@ViewChild('contentWrapper', {static: true}) _contentWrapper: ElementRef<HTMLElement>;
8888

8989
/** A stream that emits whenever the rendered range changes. */
9090
renderedRangeStream: Observable<ListRange> = this._renderedRangeSubject.asObservable();

0 commit comments

Comments
 (0)