bug(accordion) "TypeError: Cannot read property 'pipe' of undefined"
See original GitHub issueBug, feature request, or proposal:
Bug
What is the expected behavior?
That accordion works normally
What is the current behavior?
In some cases a TypeError: Cannot read property 'pipe' of undefined
is fired, breaking everything.
What are the steps to reproduce?
I tried to reproduce the behaviour but could not reproduce on StackBlitz. If I remove the accordion wrapper, there are no problems with underlying expansion panels. The error is fired here
apparently because _stateChanges
results undefined.
At first I thought it was some problem of my code, but the bug presented itself in two different and unrelated occasions.
In both occasions I’m adding dynamically the component which is using the accordion: in one case I’m loading the component using ComponentFactoryResolver
, in the second one I’m loading the component with the Router and putting it in a router-outlet
.
This is my StackBlitz trial until now (as I said, it works fine, because I cannot pinpoint the real issue): https://stackblitz.com/edit/angular-material2-issue-netdsn
What is the use-case or motivation for changing an existing behavior?
It’s broken.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 6.1.2 Material 6.4.7 TS 2.9.x
Is there anything else we should know?
Everything worked fine with Material 6.4.5, it broke when I upgraded to 6.4.7.
If anyone has suggestion in where I should look for further debugging, I’ll be glad to try.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top GitHub Comments
@IlCallo Thanks for your issue. For some reason I couldn’t think of any scenario where
_stateChanges
is undefined because we have a safety check forpanel.accordion
and the accordion initializes always with the_stateChanges
property member.Could it be the case that the CDK and Material version mismatch on your local project? This would explain why the
_stateChanges
property member is undefined.You guessed right (are you a magician?): it was a mismatch version problem. My package.json got messed up for some reason and with last update it updated all packages except for the CDK one, thank you!