Reputation: 40
I’m having an issue where I am setting a component's data with something like this
document.querySelector("#card1")
.setAttribute('card', {assetArray: items.swapper_1,
deletedItemNum: nextProps.projects.deletedItemNum,
deleteUpdate: true});
then in my update function I’m setting the deleteUpdate
value back to false
. But, when I come back around to update the component again with something like this
document.querySelector("#card1").setAttribute('card', "assetArray", items.swapper_1);
a-frame is using the cached value of deleteUpdate which is true
because, I'm assuming, I had used it in the previous .setAttribute
. Then, in my update function, this.data.deleteUpdate
is now true
even though I had set it back to false
. Not sure how to work around this.
Upvotes: 0
Views: 150
Reputation: 13233
How are you setting deleteUpdate
? .setAttribute('card', 'deleteUpdate', false)
?
Or you can just use this.deleteUpdate = false;
for state variable.
Upvotes: 1
Reputation: 40
I ended up having to set this.attrValue.deleteUpdate to false at the end of my update function. I guess the cached values used for .setAttribute are stored there and when you are updating attributes, any undeclared value that you are using will use the cached value as I suspected. I could be wrong on how it's working but that's what it seems like.
Upvotes: 0