Skip to content

Commit acb11b4

Browse files
mejo-backportbot-nextcloud[bot]
authored andcommitted
Don't empty list of headings in onDestroy
When switching pages in Collectives, `onDestroy` from the old editor instance happens *after* `onCreate` of the new editor instance. Since both share the same vuex store, this leads to a race condition where the old instance clears the list of headings of the new instance. Since we always set headings during `onCreate` anyway, there's no need to clear the headings in `onDestroy`, so let's simply get rid of it. Signed-off-by: Jonas <[email protected]>
1 parent e3fb943 commit acb11b4

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

src/components/Editor/TableOfContents.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export default {
3434
}),
3535
},
3636
mounted() {
37-
3837
setTimeout(() => {
3938
this.initialRender = false
4039
}, 1000)

src/nodes/Heading/index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import TipTapHeading from '@tiptap/extension-heading'
22
import { VueNodeViewRenderer } from '@tiptap/vue-2'
33
import debounce from 'debounce'
4-
import { setHeadings, extractHeadings } from './extractor.js'
4+
import { extractHeadings } from './extractor.js'
55
import HeaderViewVue from './HeadingView.vue'
66

77
const Heading = TipTapHeading.extend({
@@ -45,14 +45,6 @@ const Heading = TipTapHeading.extend({
4545
})
4646
},
4747

48-
onDestroy() {
49-
setHeadings([])
50-
51-
if (this.parent) {
52-
this.parent()
53-
}
54-
},
55-
5648
onCreate() {
5749
extractHeadings(this.editor)
5850

0 commit comments

Comments
 (0)