Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

Cannot read property 'id' of null #487

Closed
Larisho opened this issue Jul 13, 2016 · 5 comments
Closed

Cannot read property 'id' of null #487

Larisho opened this issue Jul 13, 2016 · 5 comments
Assignees
Labels

Comments

@Larisho
Copy link

Larisho commented Jul 13, 2016

For some reason, nothing is showing up in the component section of Augury.
augury_err

It gave me these errors in the console:
augury_err2

And this is where the error was thrown:
augury_err3

My HTML is the same for 4 different components and the other 4 are evaluated correctly by Augury.

Am I doing something wrong?

Let me know if you need more info

EDIT I've discovered that this line of code in my HTML file is causing these errors in Augury
<input [(ngModel)]="details.name" id="name" type="text">
Any ideas?

Thanks,

@ericjim
Copy link
Contributor

ericjim commented Jul 13, 2016

Hey @Larisho I'll look into it. To facilitate my investigation, what version of Angular 2 are you using, and which router are you using?

@Larisho
Copy link
Author

Larisho commented Jul 13, 2016

@ericjim Here's a pic of my package.json (in case you need more details)

augury_err4

Thanks a mil!

@sumitarora sumitarora added the bug label Jul 16, 2016
@Larisho
Copy link
Author

Larisho commented Jul 22, 2016

@ericjim I found the problem. It happens when I use <input>s without using <form> tags.

Ex:
<form><input></form> works
<input> doesn't work

@andrewlo
Copy link

andrewlo commented Jul 25, 2016

@Larisho I've created a mini-app with an <input type="text"> without <form> around it, opened augury, highlighted the nodes and so far it has not given the error.

If possible could you create a plunker or sample app/code to reproduce? Or any other tips on reproducing? Thanks

@Ov3rlo4d
Copy link

I'm experiencing this issue as well.

The issue can be also reproduced at http://www.primefaces.org/primeng/#/dropdown
Removing the dropdown html tag solves the issue, so that component is probably the cause.

I didn't manage to work around the issue using form tags.

@andrewlo andrewlo self-assigned this Jul 26, 2016
andrewlo pushed a commit that referenced this issue Jul 26, 2016
Option elements are excluded from being added to the compoment tree.

However, we must also exclude them from being numbered when assigning
augury-id's.

Otherwise, if we have option elements with other elements after it, we
will get undefined elements in the parent component's child array in the
component tree, since it assigns to the child array using the augury-id
as an index to the array.

Example:
If we have 4 <option> elements with a <div> after it, then the four
<option> elements have augury-id 0 to 3 and the <div> would get id 4.

When adding to the child array of the parent, the four <option>
elements are not added. The <div> after is added, but is added to index
4 in the child array. This creates undefined elements in positions 0-3 in
the array.

The front-end is then given the componet tree and a JS error is thrown
when the user highlights the null node.
andrewlo pushed a commit that referenced this issue Jul 26, 2016
Option elements are excluded from being added to the compoment tree.

However, we must also exclude them from being numbered when assigning
augury-id's.

Otherwise, if we have option elements with other elements after it, we
will get undefined elements in the parent component's child array in the
component tree, since it assigns to the child array using the augury-id
as an index to the array.

Example:
If we have 4 <option> elements with a <div> after it, then the four
<option> elements have augury-id 0 to 3 and the <div> would get id 4.

When adding to the child array of the parent, the four <option>
elements are not added. The <div> after is added, but is added to index
4 in the child array. This creates undefined elements in positions 0-3 in
the array.

The front-end is then given the component tree and a JS error is thrown
when the user highlights the null node.
andrewlo pushed a commit that referenced this issue Jul 26, 2016
Option elements are excluded from being added to the component tree.

However, we must also exclude them from being numbered when assigning
augury-id's.

Otherwise, if we have option elements with other elements after it, we
will get undefined elements in the parent component's child array in the
component tree, since it assigns to the child array using the augury-id
as an index to the array.

Example:
If we have 4 <option> elements with a <div> after it, then the four
<option> elements have augury-id 0 to 3 and the <div> would get id 4.

When adding to the child array of the parent, the four <option>
elements are not added. The <div> after is added, but is added to index
4 in the child array. This creates undefined elements in positions 0-3 in
the array.

The front-end is then given the component tree and a JS error is thrown
when the user highlights the null node.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants