mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-14 22:32:24 +08:00
Fix broken React unmount because of non-existing view on unmount (#6284)
* fixed a bug with the React EditorContent component on unmount when editor view not available * added changeset
This commit is contained in:
parent
ef3a7e497c
commit
3aa670a788
5
.changeset/shaggy-hats-rescue.md
Normal file
5
.changeset/shaggy-hats-rescue.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@tiptap/react': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixed a bug in the EditorContent component that caused a crash in Firefox based browsers because of the editor view not being available when an uninitialized editor is unmounted (for example via Strict mode)
|
@ -164,10 +164,14 @@ export class PureEditorContent extends React.Component<
|
|||||||
|
|
||||||
this.initialized = false
|
this.initialized = false
|
||||||
|
|
||||||
if (!editor.isDestroyed) {
|
try {
|
||||||
editor.view.setProps({
|
if (!editor.isDestroyed) {
|
||||||
nodeViews: {},
|
editor.view.setProps({
|
||||||
})
|
nodeViews: {},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// ignore error as we can't set props on a non-existing view
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.unsubscribeToContentComponent) {
|
if (this.unsubscribeToContentComponent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user