Skip to content

Commit 30f4bf4

Browse files
fix removing comments when forking
1 parent d98ceed commit 30f4bf4

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,21 @@ export class ModelsHandler {
154154
);
155155
}
156156

157+
public clearComments() {
158+
if (COMMENTS) {
159+
Object.values(this.moduleModels).forEach(moduleModel => {
160+
if (!moduleModel.model) {
161+
return;
162+
}
163+
moduleModel.comments = [];
164+
moduleModel.currentCommentDecorations = moduleModel.model.deltaDecorations(
165+
moduleModel.currentCommentDecorations,
166+
[]
167+
);
168+
});
169+
}
170+
}
171+
157172
public isModuleOpened(module: Module) {
158173
const moduleModel = this.getModuleModelByPath(module.path);
159174
return Boolean(moduleModel?.model);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,10 @@ export class VSCodeEffect {
604604
});
605605
}
606606

607+
public clearComments() {
608+
this.modelsHandler.clearComments();
609+
}
610+
607611
public setCorrections = (corrections: ModuleCorrection[]) => {
608612
const activeEditor = this.editorApi.getActiveCodeEditor();
609613
if (activeEditor) {

packages/app/src/app/overmind/namespaces/editor/internalActions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ export const forkSandbox: AsyncAction<{
431431
state.workspace.project.description = forkedSandbox.description || '';
432432
state.workspace.project.alias = forkedSandbox.alias || '';
433433

434+
effects.vscode.clearComments();
434435
Object.assign(state.editor.sandboxes[currentSandboxId]!, forkedSandbox);
435436
state.editor.modulesByPath = effects.vscode.sandboxFsSync.create(
436437
forkedSandbox

0 commit comments

Comments
 (0)