File tree Expand file tree Collapse file tree 2 files changed +27
-21
lines changed
packages/app/src/app/overmind/effects/vscode Expand file tree Collapse file tree 2 files changed +27
-21
lines changed Original file line number Diff line number Diff line change 77} from '@codesandbox/common/lib/types' ;
88import { getTextOperation } from '@codesandbox/common/lib/utils/diff' ;
99import { hasPermission } from '@codesandbox/common/lib/utils/permission' ;
10+ import { COMMENTS } from '@codesandbox/common/lib/utils/feature-flags' ;
1011import { indexToLineAndColumn } from 'app/overmind/utils/common' ;
1112import { actions , dispatch } from 'codesandbox-api' ;
1213import { 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 } ;
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments