Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree view => Cannot read properties of undefined (reading 'value') #8708

Öffnen Sie
Lavos96 opened this issue Aug 23, 2024 · 3 comments
Öffnen Sie

Tree view => Cannot read properties of undefined (reading 'value') #8708

Lavos96 opened this issue Aug 23, 2024 · 3 comments
Assignees

Kommentare

@Lavos96
Copy link

Lavos96 commented Aug 23, 2024

Reproduction link

https://stackblitz.com/edit/ng-zorro-antd-ivy?file=package.json

Steps to reproduce

During initialization of tree-view component we get this error (there was no error in last version before 18 which is 17.4.1):

ERROR TypeError: Cannot read properties of undefined (reading 'value')
at NzTreeViewComponent._initializeKeyManager (tree.mjs:492:46)
at NzTreeViewComponent.ngAfterContentInit (tree.mjs:332:14)
at callHookInternal (core.mjs:5150:14)
at callHook (core.mjs:5177:13)
at callHooks (core.mjs:5131:17)
at executeInitAndCheckHooks (core.mjs:5081:9)
at refreshView (core.mjs:13811:21)
at detectChangesInView (core.mjs:13982:9)
at detectChangesInViewIfAttached (core.mjs:13942:5)
at detectChangesInComponent (core.mjs:13931:5)

If we get closer look at NzTreeViewComponent._initializeKeyManager, we see that:

const keyManagerOptions = {
trackBy: node => this._getExpansionKey(node.data),
skipPredicate: node => !!node.isDisabled,
typeAheadDebounceInterval: true,
horizontalOrientation: this._dir.value, <--- here we got error
};

It is connected to unset Directionality, i dont know but this maybe should look like this in order to eliminate this error: this._dir?.value || 'ltr'

What is expected?

There should be no error in console

What is actually happening?

There is error in console

Environment Info
ng-zorro-antd 18.1.1
Browser Chrome
@Lavos96
Copy link
Author

Lavos96 commented Aug 23, 2024

this could be connected: angular/components#29595

@mcgorden
Copy link

I met the same error too, and it blocks my work! Could you please provide a solution that works?

@Lavos96
Copy link
Author

Lavos96 commented Sep 18, 2024

It seems that issue have been resolved in version 18.2.2 of angular/components lib (https://github.com/angular/components/releases/tag/18.2.2 , angular/components#29648) . So in order to get rid of this error angular/components lib should be upgraded to version 18.2.2 or higher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants