-
Notifications
You must be signed in to change notification settings - Fork 22
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
Uncaught TypeError: Cannot read property 'push' of null #10
Comments
Hi @barkerb1 Can you give a scenario that this.tags is null? |
It's been awhile since I found the issue, but I believe it was when data wasn't bound initially on load. |
tags is already having default value to be empty array. So this should not happen though. You mean this.tags is not bind with the variables that's assigning to tags property? |
He probably bound a property with a default value of Related: it's well worth noting here that your default value initialization of the |
Also, |
@apalaniuk you're right, instanceof would be the right approach.
Now that I look into it, I implemented it without using a tags property. When I persist the tags I accessed them using pure javascript:
I used the following approach because there's no guarantee in the hierarchy where the tags will be in the DOM in relation to the element that's reading the tags, i.e. paper-tags-input maybe a sibling, cousins, grandchild element. |
@barkerb1 It must have something to do with how you're modifying the |
@apalaniuk Which means, if they both have initial variable assign to tags property, they will work fine as expected, as we see in the demo, right? |
@cheonhyangzhang Exactly. |
Got it. This is for the purpose to make issue management easier. |
@apalaniuk @barkerb1 |
Array not initialized error, recommend changing _addTag function as follows:
Added
this.tags == null
to catch the issueThe text was updated successfully, but these errors were encountered: