Skip to content

Commit d3209c2

Browse files
committed
fix: mark virtual scroll viewport queries as static
1 parent 326f0ee commit d3209c2

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
@@ -834,8 +834,8 @@ function triggerScroll(viewport: CdkVirtualScrollViewport, offset?: number) {
834834
encapsulation: ViewEncapsulation.None,
835835
})
836836
class FixedSizeVirtualScroll {
837-
@ViewChild(CdkVirtualScrollViewport) viewport: CdkVirtualScrollViewport;
838-
@ViewChild(CdkVirtualForOf) virtualForOf: CdkVirtualForOf<any>;
837+
@ViewChild(CdkVirtualScrollViewport, {static: true}) viewport: CdkVirtualScrollViewport;
838+
@ViewChild(CdkVirtualForOf, {static: true}) virtualForOf: CdkVirtualForOf<any>;
839839

840840
@Input() orientation = 'vertical';
841841
@Input() viewportSize = 200;
@@ -885,7 +885,7 @@ class FixedSizeVirtualScroll {
885885
encapsulation: ViewEncapsulation.None,
886886
})
887887
class FixedSizeVirtualScrollWithRtlDirection {
888-
@ViewChild(CdkVirtualScrollViewport) viewport: CdkVirtualScrollViewport;
888+
@ViewChild(CdkVirtualScrollViewport, {static: true}) viewport: CdkVirtualScrollViewport;
889889

890890
@Input() orientation = 'vertical';
891891
@Input() viewportSize = 200;

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

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

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

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

0 commit comments

Comments
 (0)