From 96320478e6a73efdffe363487fc3d95e00364ba1 Mon Sep 17 00:00:00 2001 From: dwelle Date: Wed, 11 Mar 2020 22:30:00 +0100 Subject: [PATCH] remove remote pointers on client disconnect --- src/components/App.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/App.tsx b/src/components/App.tsx index 2305488e..4c102fce 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -340,6 +340,12 @@ export class App extends React.Component { this.socket.on("room-user-count", (collaboratorCount: number) => { this.setState({ collaboratorCount }); }); + this.socket.on("client-disconnected", (socketID: number) => { + this.setState(state => { + const { [socketID]: omit, ...remotePointers } = state.remotePointers; + return { remotePointers }; + }); + }); this.socket.on("new-user", async (socketID: string) => { this.broadcastSocketData({ type: "SCENE_UPDATE",