mirror of
https://github.com/outline/outline.git
synced 2026-12-02 01:34:47 +03:00
fix: Awareness state not available if server dies and restarts
This commit is contained in:
1 parent
a28dfa77ee
commit
700db463fc
3 files changed
+10
-8
No files matched your search
@@ -19,9 +19,13 @@ export default class MultiplayerExtension extends Extension {
|
||||
const { user, provider, doc } = this.options;
|
||||
const type = doc.get("prosemirror", Y.XmlFragment);
|
||||
|
||||
provider.awareness.setLocalStateField("user", {
|
||||
color: user.color,
|
||||
name: user.name,
|
||||
provider.on("status", ({ status }) => {
|
||||
if (status === "connected") {
|
||||
provider.awareness.setLocalStateField("user", {
|
||||
color: user.color,
|
||||
name: user.name,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const permanentUserData = new Y.PermanentUserData(doc);
|
||||
|
||||
@@ -293,6 +293,8 @@ export class WebsocketProvider extends Observable {
|
||||
}
|
||||
console.log("user.join");
|
||||
|
||||
this.awareness.setLocalState({});
|
||||
|
||||
this.emit("status", [
|
||||
{
|
||||
status: "connected",
|
||||
|
||||
@@ -33,11 +33,7 @@ export default function SocketPresence(props: Props) {
|
||||
|
||||
context.on("authenticated", () => {
|
||||
console.log("authenticated");
|
||||
|
||||
// wait just a hair to join the presence room, this is mainly for a
|
||||
// development race condition where the join event could be emitted before
|
||||
// the listener is added on the server
|
||||
setTimeout(emitJoin, 100);
|
||||
emitJoin();
|
||||
});
|
||||
|
||||
if (context.authenticated) {
|
||||
|
||||
Reference in new issue
Block a user