mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-14 22:32:24 +08:00
refactor(react): throw an error if misconfigured in SSR mode
This commit is contained in:
parent
96601f7c99
commit
08593a279f
5
.changeset/perfect-rice-vanish.md
Normal file
5
.changeset/perfect-rice-vanish.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@tiptap/react": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Throw an error in development mode if immediatelyRender is not set in SSR mode
|
@ -100,13 +100,12 @@ class EditorInstanceManager {
|
|||||||
private getInitialEditor() {
|
private getInitialEditor() {
|
||||||
if (this.options.current.immediatelyRender === undefined) {
|
if (this.options.current.immediatelyRender === undefined) {
|
||||||
if (isSSR || isNext) {
|
if (isSSR || isNext) {
|
||||||
// TODO in the next major release, we should throw an error here
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
/**
|
/**
|
||||||
* Throw an error in development, to make sure the developer is aware that tiptap cannot be SSR'd
|
* Throw an error in development, to make sure the developer is aware that tiptap cannot be SSR'd
|
||||||
* and that they need to set `immediatelyRender` to `false` to avoid hydration mismatches.
|
* and that they need to set `immediatelyRender` to `false` to avoid hydration mismatches.
|
||||||
*/
|
*/
|
||||||
console.warn(
|
throw new Error(
|
||||||
'Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.',
|
'Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches.',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user