fix: Race condition with setting awareness field

This commit is contained in:
Tom Moor
2023-09-20 23:48:14 -04:00
parent 27befbf3f7
commit 34d4209dd5

View File

@@ -32,11 +32,7 @@ export default class Multiplayer extends Extension {
}
};
// only once we have authenticated successfully do we initalize awareness.
// we could send this earlier, but getting authenticated faster is more important
provider.on("authenticated", () => {
provider.setAwarenessField("user", user);
});
provider.setAwarenessField("user", user);
// only once an actual change has been made do we add the userId <> clientId
// mapping, this avoids stored mappings for clients that never made a change