{"action":"opened","issue":{"url":"https://api.github.com/repos/ProseMirror/prosemirror/issues/648","repository_url":"https://api.github.com/repos/ProseMirror/prosemirror","labels_url":"https://api.github.com/repos/ProseMirror/prosemirror/issues/648/labels{/name}","comments_url":"https://api.github.com/repos/ProseMirror/prosemirror/issues/648/comments","events_url":"https://api.github.com/repos/ProseMirror/prosemirror/issues/648/events","html_url":"https://github.com/ProseMirror/prosemirror/issues/648","id":230899645,"number":648,"title":"NodeView update() with the wrong node is called instead of destroy() for undo command","user":{"login":"1999","id":73191,"avatar_url":"https://avatars3.githubusercontent.com/u/73191?v=3","gravatar_id":"","url":"https://api.github.com/users/1999","html_url":"https://github.com/1999","followers_url":"https://api.github.com/users/1999/followers","following_url":"https://api.github.com/users/1999/following{/other_user}","gists_url":"https://api.github.com/users/1999/gists{/gist_id}","starred_url":"https://api.github.com/users/1999/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1999/subscriptions","organizations_url":"https://api.github.com/users/1999/orgs","repos_url":"https://api.github.com/users/1999/repos","events_url":"https://api.github.com/users/1999/events{/privacy}","received_events_url":"https://api.github.com/users/1999/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-24T02:05:24Z","updated_at":"2017-05-24T02:05:24Z","closed_at":null,"body":"We found a problem using NodeViews and Cmd+Z undo command.\r\nInstead of calling destroy() of the NodeView update() is called with a wrong node.\r\n\r\n## Our schema\r\n\r\n * doc: prosemirror-schema-basic's doc\r\n * paragraph: prosemirror-schema-basic's paragraph\r\n * mediaGroup: block, can have media+ nodes\r\n * media: inline\r\n\r\nWe also have a NodeView for mediaGroup nodes.\r\nReproduce steps:\r\n\r\n1) add text line to the document, for example \"sfsdfsdfsdfsdf\", hit enter (second paragraph is created)\r\n2) add media node into the document on the second line with `view.dispatch(tr.replaceWith(...))`, i.e. replace paragraph with the media node. Prosemirror handles this by wrapping the media node with the mediaGroup and NodeView is created.\r\n3) add one more line of text under the mediaGroup\r\n4) Cmd+Z - removes the line paragraph from step 3\r\n5) Cmd+Z - we expect to have mediaGroup NodeView to be destroyed here. Instead NodeView object's update() function is called instead for node of different type (paragraph). State document is doc(paragraph, paragraph)."}}
{"actor":{"display_login":"1999"}}