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
Angular Material Table Error - Cannot read property 'find' of undefined ... #11427
Comments
This is due to an issue with how the Angular compiler was compiling our ES6 version. This should be fixed in the next patch release. See #9329 for details Also, thanks for diving into the code and finding the offending line. That helped saved me a lot of time understanding the issue |
Thanks @andrewseguin for being on top of this! My table is the core of my app and not much dev work can be done until it renders. Rather stuck. |
@svstartuplab Keep an eye out today or tomorrow for our next patch release |
Thanks @andrewseguin, the issue is fixed :-) |
Glad to hear it! Thanks for verifying |
Hello, I'm pretty sure this issue is back with the release of 6.4.2.. i verified this by changing the Here's my html:
And my component's ngOnInit:
|
Same here V6.4.1 is working. V6.4.2 and V6.4.3 throws an error:
HTML: |
hvdscheer, you have a coding error. A var isn't being populated with data so it is undefined. |
I was receiving the same error and reverting back to 6.4.1 (angular/material and angular/cdk) fixed this for me. Was on 6.4.5 |
Although the error stack trace leads to my own component the error is thrown in the material code. The "displayedColumns" is a hardcoded string array in my code. Again, in 6.4.1 everything is working fine. When i upgrade to 6.4.2 or 6.4.3 this error occurs. |
6.4.6, still an issue. Revert to 6.4.1 as it's suggested fixed the problem. |
@andrewseguin Please re-open this issue, it is no longer fixed |
Reverting back versions cannot ever be considered as fix. So issue should be reopened, until it is working on latest versions! |
Sorry guys, this is something that needs to be fixed in Angular. See this issue for its status: angular/angular#27267 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Possible bug. Something changed in Angular Material 6 and was a breaking change for my project.
My table was working fine since it was introduced in Angular Material. I upgraded from Angular 5 to 6 and now I get this error when rendering the table:
TypeError: Cannot read property 'find' of undefined
at MatHeaderRowDef.ngOnChanges (table.js:47)
No data is yet loaded, a button does that. When I click the button:
TypeError: Cannot read property 'diff' of undefined
at MatRowDef.getColumnsDiff (table.js:57)
If I comment out a column then the error throws for the next column above it in the table so that all columns will produce this error, only one column at each render though.
The offending code in webpack:///./node_modules/@angular/cdk/esm2015/table.js:
My table (shortened to two columns):
In the component.ts file:
What is the expected behavior?
Table should compile with this error.
What is the current behavior?
The problem may be related to this closed issue but a bit different:
#6831
What are the steps to reproduce?
My first try with Stackblitz, never used Plunker, so probably something wrong. I shortened my code to just the problem code for the table. The error message goes away if I comment out the table. Other items on the page such as search don't affect this.
https://stackblitz.com/edit/angular-material2-issue-yp6jrt
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Is there anything else we should know?
I followed upgrade.angular.io and used these magic lines in terminal:
I don't see how this could have affected my table. I suspect that something was changed for AM 6 and is causing a bug under some circumstances. My setup seems rather typical though.
The text was updated successfully, but these errors were encountered: