Skip to content

bug(accordion) "TypeError: Cannot read property 'pipe' of undefined" #13121

@IlCallo

Description

@IlCallo

Bug, 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

https://github.com/angular/material2/blob/32a001051f15d5073475c7c3bc17a0a46dabf4cd/src/lib/expansion/expansion-panel-header.ts#L73-L74

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions