Skip to content

Commit a607be7

Browse files
committed
Fix resetting user selections when a user leaves
1 parent 1f0c8cf commit a607be7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/app/src/app/overmind/effects/vscode/ModelsHandler.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,11 @@ export class ModelsHandler {
327327
const model = await moduleModel.model;
328328

329329
decorations.forEach(decorationId => {
330-
if (decorationId.startsWith(userId + model.id)) {
330+
const userDecorationIdPrefix = this.getSelectionDecorationId(
331+
userId,
332+
model.id
333+
);
334+
if (decorationId.startsWith(userDecorationIdPrefix)) {
331335
this.userSelectionDecorations[decorationId] = model.deltaDecorations(
332336
this.userSelectionDecorations[decorationId] || [],
333337
[]
@@ -339,9 +343,9 @@ export class ModelsHandler {
339343

340344
private getSelectionDecorationId = (
341345
userId: string,
342-
modelId: string,
343-
shortid: string
344-
) => [userId, modelId, shortid].join('|');
346+
modelId: string = '',
347+
shortid: string = ''
348+
) => [userId, modelId, shortid].join('|').replace(/\|\|$/, '|');
345349

346350
private cleanUserSelections = (
347351
model: any,

0 commit comments

Comments
 (0)