Commit 3ddf3cff authored by Robert Knight's avatar Robert Knight

Explain why new guests must be added to `_guestRPC` map immediately

parent 71476ef9
......@@ -225,12 +225,15 @@ export class FrameSyncService {
/** @type {PortRPC<GuestToSidebarEvent, SidebarToGuestEvent>} */
const guestRPC = new PortRPC();
// Generate a temporary ID for this guest until we learn its "real" ID.
// Add guest RPC to map with a temporary ID until we learn the real ID.
//
// We need to add the guest to the map immediately so that any notifications
// sent from this service to all guests, before we learn the real frame ID,
// are sent to this new guest.
++this._nextGuestId;
let frameIdentifier = /** @type {string|null} */ (
`temp-${this._nextGuestId}`
);
this._guestRPC.set(frameIdentifier, guestRPC);
// Update document metadata for this guest. We currently assume that the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment