fix local doc clearing
This commit is contained in:
parent
a9a31f8810
commit
61011e5e0f
2 changed files with 6 additions and 5 deletions
|
@ -57,6 +57,7 @@ export default (io: Server, socket: Socket) => {
|
||||||
action: "remove",
|
action: "remove",
|
||||||
socketId: socket.id,
|
socketId: socket.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const clients = io.sockets.adapter.rooms.get(socketRooms[0]);
|
const clients = io.sockets.adapter.rooms.get(socketRooms[0]);
|
||||||
if (!clients || clients.size == 0) {
|
if (!clients || clients.size == 0) {
|
||||||
MissionMap.delete(socketRooms[0]);
|
MissionMap.delete(socketRooms[0]);
|
||||||
|
|
|
@ -193,11 +193,6 @@ export default (io: Server, socket: Socket) => {
|
||||||
const socketRooms = Array.from(socket.rooms).filter((room) => room !== socket.id && room !== "home");
|
const socketRooms = Array.from(socket.rooms).filter((room) => room !== socket.id && room !== "home");
|
||||||
socket.leave(socketRooms[0]);
|
socket.leave(socketRooms[0]);
|
||||||
|
|
||||||
const clients = io.sockets.adapter.rooms.get(socketRooms[0]);
|
|
||||||
if (!clients || clients.size == 0) {
|
|
||||||
MissionMap.delete(socketRooms[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
MissionMap.updateAwareness(socketRooms[0], {
|
MissionMap.updateAwareness(socketRooms[0], {
|
||||||
action: "remove",
|
action: "remove",
|
||||||
store: "editors",
|
store: "editors",
|
||||||
|
@ -224,6 +219,11 @@ export default (io: Server, socket: Socket) => {
|
||||||
socketId: socket.id,
|
socketId: socket.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const clients = io.sockets.adapter.rooms.get(socketRooms[0]);
|
||||||
|
if (!clients || clients.size == 0) {
|
||||||
|
MissionMap.delete(socketRooms[0]);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: "deleted",
|
type: "deleted",
|
||||||
answer: "leave instance",
|
answer: "leave instance",
|
||||||
|
|
Loading…
Add table
Reference in a new issue