diff --git a/components/tree-view/tree-virtual-scroll-view.ts b/components/tree-view/tree-virtual-scroll-view.ts index 4f0d6db98ac..6b05154dab8 100644 --- a/components/tree-view/tree-virtual-scroll-view.ts +++ b/components/tree-view/tree-virtual-scroll-view.ts @@ -99,6 +99,19 @@ export class NzTreeVirtualScrollViewComponent extends NzTreeView implement this.changeDetectorRef.markForCheck(); } + /** + * @note + * angular/cdk v18.2.0 breaking changes: https://github.com/angular/components/pull/29062 + * Temporary workaround: revert to old method of getting level + * TODO: refactor tree-view, remove #treeControl and adopt #levelAccessor and #childrenAccessor + * */ + override _getLevel(nodeData: T): number | undefined { + if (this.treeControl.getLevel) { + return this.treeControl.getLevel(nodeData); + } + return; + } + private createNode(nodeData: T, index: number): NzTreeVirtualNodeData { const node = this._getNodeDef(nodeData, index); const context = new CdkTreeNodeOutletContext(nodeData);