# Changing attributes doesn't trigger NodeView.update()

**URL:** <https://discuss.prosemirror.net/t/changing-attributes-doesnt-trigger-nodeview-update/1447>\
**Category:** Uncategorized\
**Created:** [July 27, 2018, 9:09am UTC](https://discuss.prosemirror.net/t/changing-attributes-doesnt-trigger-nodeview-update/1447 "2018-07-27T09:09:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![patsimm](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/patsimm/32/463_2.png) [@patsimm](https://discuss.prosemirror.net/u/patsimm)\
**Post date:** [July 27, 2018, 9:09am UTC](https://discuss.prosemirror.net/t/changing-attributes-doesnt-trigger-nodeview-update/1447/1 "2018-07-27T09:09:55Z")

</div>

We’re rendering our own NodeView component. The NodeType for which we are building the NodeView has some attributes and the look of our NodeView is dependent on those attributes. I was trying out a lot of things but it looks like neither `NodeView.update()` nor the NodeView’s constructor is not called when only changing a nodes attributes. This means a node is not rerendering when it’s attributes change.

I am not sure if this is a bug or it is supposed to work this way. Maybe there also is another way of doing what I want to do that I just couldn’t figure out yet… Any help appreciated 🙂

---

<div class="post-metadata">

**Author:** ![marijn](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/marijn/32/15_2.png) [@marijn](https://discuss.prosemirror.net/u/marijn)\
**Post date:** [July 27, 2018, 8:40pm UTC](https://discuss.prosemirror.net/t/changing-attributes-doesnt-trigger-nodeview-update/1447/2 "2018-07-27T20:40:44Z")

</div>

How are you changing the attributes? Could you set up a minimal demo of the problem?

---

<div class="post-metadata">

**Author:** ![patsimm](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/patsimm/32/463_2.png) [@patsimm](https://discuss.prosemirror.net/u/patsimm)\
**Post date:** [July 31, 2018, 8:36am UTC](https://discuss.prosemirror.net/t/changing-attributes-doesnt-trigger-nodeview-update/1447/3 "2018-07-31T08:36:00Z")

</div>

So I dig a bit further into the problem and it was a stupid mistake on our side. We accidentally mutated the nodes attributes directly and then dispatched a `setNodeMarkup` Command. In case anyone has a similar problem: Really keep an eye that you do not mutate the node directly but always use clones of the objects to perform your operations on.

I modified the dinosaur example a little, so if you click on a dinosaur the type of the dinosaur changes. A working example can be found here: [https://glitch.com/edit/#!/walnut-beech](https://glitch.com/edit/#!/walnut-beech)
