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

SuiSelect: Cannot read property 'isVisible' of undefined #446

Open
nicoparce opened this issue Mar 9, 2020 · 3 comments
Open

SuiSelect: Cannot read property 'isVisible' of undefined #446

nicoparce opened this issue Mar 9, 2020 · 3 comments

Comments

@nicoparce
Copy link

When upgraded Angular to version 9, SuiSelect component is not working properly because of the following excpetion:

"TypeError: Cannot read property 'isVisible' of undefined
at SuiSelect.get [as isVisible] (http://localhost:4200/vendor.js:133588:31)
at SuiSelectBase_HostBindings (http://localhost:4200/vendor.js:134176:156)
at setHostBindingsByExecutingExpandoInstructions (http://localhost:4200/vendor.js:21588:25)
at refreshView (http://localhost:4200/vendor.js:21864:9)
at refreshComponent (http://localhost:4200/vendor.js:22952:9)
at refreshChildComponents (http://localhost:4200/vendor.js:21625:9)
at refreshView (http://localhost:4200/vendor.js:21868:13)
at refreshDynamicEmbeddedViews (http://localhost:4200/vendor.js:22888:21)
at refreshView (http://localhost:4200/vendor.js:21842:9)
at refreshComponent (http://localhost:4200/vendor.js:22952:9)"

Version of Angular, ng2-semantic-ui, and Semantic UI:

Angular: 9.0.3

ng2-semantic-ui: 0.9.7 or 0.10.0-alpha.6

Semantic UI: 2.2.13

@Piquelyz
Copy link

Piquelyz commented Apr 7, 2020

Hi @nicoparce ,
I have the same problem after update Angular 9.

After debug, I found in Angular 9 there is a change to the decorator 'ViewChild',

// query results sometimes available in ngOnInit, sometimes in ngAfterViewInit` (based on template)
@ViewChild('foo') foo: ElementRef;

Angular 9:
// query results available in ngOnInit
@ViewChild('foo', {static: true}) foo: ElementRef;

OR // query results available in ngAfterViewInit
@ViewChild('foo', {static: false}) foo: ElementRef; (by default)

`
In Angular 9, by default({static: false}) the viewChild will be init after 'ngAfterViewInit ', that's why some properties are 'undefined '.

To corrrect this, we need to update ng-semantic-ui by changing all @ViewChild by adding {static: true}

For more info, you can see here
Static query migration guide

@Piquelyz
Copy link

Piquelyz commented Apr 7, 2020

But seeing nobody updating this lib, I dont know if it's possible to use it in Angular 9.

@christianmlima
Copy link

I tried the "static: false" approach and it didn't worked.

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

No branches or pull requests

3 participants