# Question on node views

**URL:** <https://discuss.prosemirror.net/t/question-on-node-views/3101>\
**Category:** Uncategorized\
**Created:** [August 27, 2020, 3:56pm UTC](https://discuss.prosemirror.net/t/question-on-node-views/3101 "2020-08-27T15:56:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![onoufriosm](https://discuss.prosemirror.net/user_avatar/discuss.prosemirror.net/onoufriosm/32/1691_2.png) [@onoufriosm](https://discuss.prosemirror.net/u/onoufriosm)\
**Post date:** [August 27, 2020, 3:56pm UTC](https://discuss.prosemirror.net/t/question-on-node-views/3101/1 "2020-08-27T15:56:50Z")

</div>

I have encountered a strange behaviour with NodeViews.

I have a case where in addition to the basic prosemirror schema, I have a `section` node, which can have any number of blocks as content (e.g. paragraphs).

For this `section` node I want to take control and use a NodeView to render it.

Now, let’s say I wrap a paragraph in a section block and then hit undo.

Even though the `section` node no longer exists in the state, the nodeview itself appears to be in the dom.

I’ve created an example here to demonstrate: [https://codesandbox.io/s/modest-meninsky-rgxbq?file=/src/App.js](https://codesandbox.io/s/modest-meninsky-rgxbq?file=/src/App.js)

To reproduce:

1. Focus on “Hello” and then click on the “Wrap in section” button
2. Undo (using shortcut e.g. cmd + z)

(Please make sure you refresh the page if you want to repeat the experiment)

I would expect the paragraph to be rendered as whatever the paragraph schema defined (i.e. a `p` tag) but instead it’s rendered inside a `pre`, which is what is used by the `section` block.

Is this the expected behaviour? Shouldn’t the `section` NodeView be destroyed and then replaced by a paragraph nodeview?

---

<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:** [August 27, 2020, 7:24pm UTC](https://discuss.prosemirror.net/t/question-on-node-views/3101/2 "2020-08-27T19:24:55Z")

</div>

```auto
  update() {
    console.log("update");
    return true;
  }

```

There’s your problem. See the [docs](https://prosemirror.net/docs/ref/#view.NodeView.update) for `update`. It should only return true if the node it is given is of the type that the node view can display.
