{"id":4570,"date":"2026-05-27T21:47:27","date_gmt":"2026-05-27T14:47:27","guid":{"rendered":"https:\/\/daiilynews.cu.ma\/?p=4570"},"modified":"2026-05-27T21:47:27","modified_gmt":"2026-05-27T14:47:27","slug":"tiptap-yjs-hocuspocus-saves-content-but-other-users-only-see-updates-after-a-page-refresh","status":"publish","type":"post","link":"https:\/\/daiilynews.cu.ma\/?p=4570","title":{"rendered":"TipTap + Yjs + Hocuspocus saves content, but other users only see updates after a page refresh"},"content":{"rendered":"<p> <br \/>\n<br \/>\n                Hi everyone, I\u2019m working on a Next.js app with a TipTap editor and I\u2019m trying to enable real-time collaboration with Yjs and Hocuspocus.<\/p>\n<p>Current setup:<\/p>\n<p>Next.js app<\/p>\n<p>TipTap editor using useEditor() and EditorContent<\/p>\n<p>u\/tiptap\/extension-collaboration<\/p>\n<p>u\/tiptap\/extension-collaboration-cursor<\/p>\n<p>u\/hocuspocus\/provider on the frontend<\/p>\n<p>u\/hocuspocus\/server running separately<\/p>\n<p>Postgres stores normal TipTap JSON content<\/p>\n<p>Postgres also stores a base64 Yjs state<\/p>\n<p>Current behavior:<\/p>\n<p>User A edits a document section.<\/p>\n<p>The edit saves to the database correctly.<\/p>\n<p>User B can see the update only after refreshing the page.<\/p>\n<p>Without refreshing, User B\u2019s editor does not update live.<\/p>\n<p>What we tried:<\/p>\n<p>Started the Hocuspocus server locally.<\/p>\n<p>Added the Hocuspocus WebSocket URL to the frontend.<\/p>\n<p>The editor can switch between normal TipTap mode and Yjs collaboration mode.<\/p>\n<p>When collaboration mode is forced, the editor reads from Yjs state instead of the normal TipTap JSON content.<\/p>\n<p>If the Yjs state is empty or stale, the document appears blank.<\/p>\n<p>Main question:<\/p>\n<p>What is the correct way to initialize a TipTap editor with existing saved TipTap JSON and then move it into Yjs\/Hocuspocus collaboration mode without blanking the document?<\/p>\n<p>Specific questions:<\/p>\n<p>Should the existing TipTap JSON be converted into a Y.Doc before the editor is created?<\/p>\n<p>In collaboration mode, should the TipTap editor content option be undefined?<\/p>\n<p>What is the best practice for saving both Yjs state and normal TipTap JSON to a database?<\/p>\n<p>How can I verify that two users are connected to the same Hocuspocus document and receiving updates live?<\/p>\n<p>What are common reasons Hocuspocus\/Yjs appears to save correctly but does not broadcast updates to other users?<\/p>\n<p>Any guidance on the correct TipTap + Yjs + Hocuspocus flow would be appreciated.<\/p>\n<p><br \/>\n<br \/><a href=\"https:\/\/dev.to\/vchhabra55048\/tiptap-yjs-hocuspocus-saves-content-but-other-users-only-see-updates-after-a-page-refresh-2o60\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi everyone, I\u2019m working on a Next.js app with a TipTap editor and I\u2019m trying to enable real-time collaboration with Yjs and Hocuspocus. Current setup: Next.js app TipTap editor using useEditor() and EditorContent u\/tiptap\/extension-collaboration u\/tiptap\/extension-collaboration-cursor u\/hocuspocus\/provider on the frontend u\/hocuspocus\/server running separately Postgres stores normal TipTap JSON content Postgres also stores a base64 Yjs state [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4571,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[676],"tags":[761,765,762,763,764,826,1220,1221,760,824],"class_list":["post-4570","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech-ai","tag-coding","tag-community","tag-development","tag-engineering","tag-inclusive","tag-javascript","tag-nextjs","tag-react","tag-software","tag-webdev"],"_links":{"self":[{"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/posts\/4570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4570"}],"version-history":[{"count":0,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/posts\/4570\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=\/wp\/v2\/media\/4571"}],"wp:attachment":[{"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daiilynews.cu.ma\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}