optimistex / ngx-select-ex

Angular based replacement for select boxes
https://optimistex.github.io/ngx-select-ex/
MIT License
111 stars 42 forks source link

View destroyed error fix #173

Closed edskeizer closed 4 years ago

edskeizer commented 5 years ago

This PR fixes an error that happens in our production app:

Error: ViewDestroyedError: Attempt to use a destroyed view: detectChanges
  at viewDestroyedError (/./node_modules/@angular/core/fesm2015/core.js:25516:1)
  at debugUpdateDirectives (/./node_modules/@angular/core/fesm2015/core.js:39361:1)
  at checkAndUpdateView (/./node_modules/@angular/core/fesm2015/core.js:38376:1)
  at callWithDebugContext (/./node_modules/@angular/core/fesm2015/core.js:39716:1)
  at detectChanges (/./node_modules/@angular/core/fesm2015/core.js:27092:1)
...
(9 additional frame(s) were not displayed)

This happens when the changeDetectorRef tries to detectChanges on a destroyed view. I added an OnDestroy interface, which implements the detaching of the changeDetectorRef.

optimistex commented 5 years ago

@edskeizer Thanks for the maintain. I'll check and release it in nearest time.

optimistex commented 4 years ago

Merged manually and released as 3.7.4