Skip to content

Commit 3e3522a

Browse files
committed
More comments flags
1 parent 886936e commit 3e3522a

File tree

2 files changed

+27
-21
lines changed

2 files changed

+27
-21
lines changed

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '@codesandbox/common/lib/types';
88
import { getTextOperation } from '@codesandbox/common/lib/utils/diff';
99
import { hasPermission } from '@codesandbox/common/lib/utils/permission';
10+
import { COMMENTS } from '@codesandbox/common/lib/utils/feature-flags';
1011
import { indexToLineAndColumn } from 'app/overmind/utils/common';
1112
import { actions, dispatch } from 'codesandbox-api';
1213
import { css } from 'glamor';
@@ -161,16 +162,18 @@ export class ModelsHandler {
161162

162163
const model = await moduleModel.model;
163164

164-
const newDecorationComments = this.createCommentDecorations(
165-
moduleModel.comments,
166-
model,
167-
this.currentCommentThreadId,
168-
moduleModel.currentLine
169-
);
170-
moduleModel.currentCommentDecorations = model.deltaDecorations(
171-
moduleModel.currentCommentDecorations,
172-
newDecorationComments
173-
);
165+
if (COMMENTS) {
166+
const newDecorationComments = this.createCommentDecorations(
167+
moduleModel.comments,
168+
model,
169+
this.currentCommentThreadId,
170+
moduleModel.currentLine
171+
);
172+
moduleModel.currentCommentDecorations = model.deltaDecorations(
173+
moduleModel.currentCommentDecorations,
174+
newDecorationComments
175+
);
176+
}
174177

175178
return moduleModel.model;
176179
};

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

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,18 +146,21 @@ export class VSCodeEffect {
146146
this.onSelectionChangeDebounced = debounce(options.onSelectionChanged, 500);
147147

148148
this.prepareElements();
149-
this.options.reaction(
150-
state => ({
151-
fileComments: json(state.comments.fileComments),
152-
currentCommentId: state.comments.currentCommentId,
153-
}),
154-
({ fileComments, currentCommentId }) => {
155-
if (this.modelsHandler) {
156-
this.modelsHandler.applyComments(fileComments, currentCommentId);
149+
150+
if (COMMENTS) {
151+
this.options.reaction(
152+
state => ({
153+
fileComments: json(state.comments.fileComments),
154+
currentCommentId: state.comments.currentCommentId,
155+
}),
156+
({ fileComments, currentCommentId }) => {
157+
if (this.modelsHandler) {
158+
this.modelsHandler.applyComments(fileComments, currentCommentId);
159+
}
157160
}
158-
}
159-
);
160-
this.listenToCommentClick();
161+
);
162+
this.listenToCommentClick();
163+
}
161164

162165
// We instantly create a sandbox sync, as we want our
163166
// extension host to get its messages handled to initialize

0 commit comments

Comments
 (0)