#8326·tiptap

Vue 2 EditorContent accesses editor.view after the editor has been destroyed

Author: Trockeneis617Created Sep 8, 2026Updated Sep 8, 2026

Repository: https://github.com/ueberdosis/tiptap

In packages/vue-2/src/EditorContent.ts, beforeDestroy guards editor.view.setProps with !editor.isDestroyed, then clears contentComponent and reads editor.view.dom unconditionally. A destroyed editor whose view getter is unavailable throws during component cleanup.

Verified in @tiptap/vue-2 3.22.4, which is locked by Nextcloud Text in its v33.0.6 and v33.0.8 tags. The published npm package matches the observed distributed source byte for byte. The same TypeScript file is still present in release 3.31.3, the npm latest version checked on 2026-09-07.

Reproduction:

  1. Mount EditorContent with an editor.
  2. Destroy the editor before the Vue component is destroyed.
  3. Execute the component's beforeDestroy: it clears contentComponent, then accesses the destroyed view and throws.

Proposed change:

diff
 editor.contentComponent = null
 
-if (!editor.view.dom?.parentNode) {
+if (editor.isDestroyed || !editor.view.dom?.parentNode) {
   return
 }

Keep clearing contentComponent; skip relocation when the editor has been destroyed. Live editors still clear node views and move the existing children as before.

Validation: five tests execute the actual TypeScript method body with controlled editor/document fixtures. Before the patch, destroyed-editor cleanup and repeated destroyed cleanup fail. Afterward all five pass; live relocation, detached live cleanup and an absent editor retain their behavior. These are method tests, not a full Vue mount suite. Equivalent extracted distributed-source and bundle tests were also checked, followed by a local Chromium navigation comparison using a diagnostic response substitution. A rebuilt package has not yet been tested.