@@ -165,9 +165,16 @@ emitter.on("participant-room-data", async (entity) => {
165
165
}
166
166
167
167
if ( ! participantNameToEntity [ participantName ] ) {
168
- participantNameToEntity [ participantName ] = { faceMarkerImagePath } ;
168
+ participantNameToEntity [ participantName ] = { } ;
169
169
}
170
170
171
+ // Always want to have the latest of these
172
+ participantNameToEntity [ participantName ] = {
173
+ ...participantNameToEntity [ participantName ] ,
174
+ faceMarkerImagePath,
175
+ lastBatch,
176
+ } ;
177
+
171
178
let hubStatusVerb = "" ;
172
179
if ( inTheHub && ! participantNameToEntity [ participantName ] ?. inTheHub ) {
173
180
hubStatusVerb = "enterred" ;
@@ -184,7 +191,6 @@ emitter.on("participant-room-data", async (entity) => {
184
191
participantNameToEntity [ participantName ] = {
185
192
...participantNameToEntity [ participantName ] ,
186
193
inTheHub,
187
- lastBatch,
188
194
} ;
189
195
emitter . emit ( "in-the-hub-change" ) ;
190
196
}
@@ -197,6 +203,14 @@ emitter.on("participant-room-data", async (entity) => {
197
203
// Ignore, we already have this person in the right zoom room
198
204
return ;
199
205
}
206
+
207
+ // Remove them from their previous room
208
+ if ( previousRoomName ) {
209
+ roomNameToParticipantNames [ previousRoomName ] = roomNameToParticipantNames [
210
+ previousRoomName
211
+ ] . filter ( ( name ) => name !== participantName ) ;
212
+ }
213
+
200
214
if ( ! roomNameToParticipantNames [ roomName ] ) {
201
215
roomNameToParticipantNames [ roomName ] = [ ] ;
202
216
}
@@ -206,8 +220,6 @@ emitter.on("participant-room-data", async (entity) => {
206
220
participantNameToEntity [ participantName ] = {
207
221
...participantNameToEntity [ participantName ] ,
208
222
roomName,
209
- faceMarkerImagePath,
210
- lastBatch,
211
223
} ;
212
224
213
225
verb = "enterred" ;
@@ -227,8 +239,6 @@ emitter.on("participant-room-data", async (entity) => {
227
239
participantNameToEntity [ participantName ] = {
228
240
...participantNameToEntity [ participantName ] ,
229
241
roomName,
230
- faceMarkerImagePath,
231
- lastBatch,
232
242
} ;
233
243
234
244
verb = "departed" ;
0 commit comments