Collaboration Editor do not work #4519
Replies: 2 comments
-
This is a known timing issue with collaborative editors using Plate and Yjs. If the editor initializes before Yjs content is loaded, Plate's normalization logic inserts an empty paragraph, making the editor appear empty and unresponsive until a hot reload resets the state. To fix this, set If you still see issues, double-check that Plate isn't initializing with a default value before Yjs syncs. If you can share your provider setup or initialization code, I can help spot any other problems. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
This is a known timing issue with Plate collaborative editing and Yjs. Plate's normalization can run before Yjs finishes syncing, which leaves the editor empty and uneditable until a hot reload resets the state. To fix this, set Example pattern: const editor = useMemo(() => createPlateEditor({ /* ... */, skipInitialization: true }), []);
useEffect(() => {
if (yjsProviderIsReady) {
editor.getApi(YjsPlugin).yjs.init({ id: docId, value: initialValue });
}
return () => editor.getApi(YjsPlugin).yjs.destroy();
}, [editor, yjsProviderIsReady, docId, initialValue]); See more details and discussion here and the Yjs plugin docs. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I followed the guide to create a collaborative text editor, but the content is always empty and it's impossible to type. If the file do a hot reload (I don't reload the page manually), it works perfectly.
Plate version
49.1.13
Slate React version
1.1.0
Beta Was this translation helpful? Give feedback.
All reactions