File tree 7 files changed +23
-28
lines changed
pages/common/Modals/PreferencesModal/Experiments
7 files changed +23
-28
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
11
11
SandboxFs ,
12
12
Settings ,
13
13
} from '@codesandbox/common/lib/types' ;
14
+ import { CONTAINER_LSP } from '@codesandbox/common/lib/utils/feature-flags' ;
14
15
import { notificationState } from '@codesandbox/common/lib/utils/notifications' ;
15
16
import {
16
17
NotificationMessage ,
@@ -342,7 +343,7 @@ export class VSCodeEffect {
342
343
//
343
344
}
344
345
345
- if ( isServer && this . options . getCurrentUser ( ) ?. experiments . containerLsp ) {
346
+ if ( isServer && CONTAINER_LSP === 'true' ) {
346
347
childProcess . addDefaultForkHandler ( this . createContainerForkHandler ( ) ) ;
347
348
const socket = this . createWebsocketFSRequest ( ) ;
348
349
const cache = await this . createFileSystem ( 'WebsocketFS' , {
Original file line number Diff line number Diff line change 8
8
WindowOrientation ,
9
9
} from '@codesandbox/common/lib/types' ;
10
10
import { getTextOperation } from '@codesandbox/common/lib/utils/diff' ;
11
+ import { CONTAINER_LSP } from '@codesandbox/common/lib/utils/feature-flags' ;
11
12
import { convertTypeToStatus } from '@codesandbox/common/lib/utils/notifications' ;
12
13
import { Action , AsyncAction } from 'app/overmind' ;
13
14
import { withLoadApp , withOwnedSandbox } from 'app/overmind/factories' ;
@@ -120,11 +121,7 @@ export const sandboxChanged: AsyncAction<{ id: string }> = withLoadApp<{
120
121
state . editor . modulesByPath = fs ;
121
122
} ) ;
122
123
123
- if (
124
- sandbox . featureFlags &&
125
- sandbox . featureFlags . containerLsp &&
126
- ! sandbox . owned
127
- ) {
124
+ if ( CONTAINER_LSP === 'true' && ! sandbox . owned ) {
128
125
effects . vscode . setReadOnly ( true ) ;
129
126
effects . notificationToast . add ( {
130
127
message :
Original file line number Diff line number Diff line change
1
+ import { CONTAINER_LSP } from '@codesandbox/common/lib/utils/feature-flags' ;
1
2
import React , { useState , useEffect } from 'react' ;
2
3
import { useOvermind } from 'app/overmind' ;
3
4
import { SubDescription , PaddedPreference } from '../elements' ;
@@ -6,9 +7,7 @@ export const ContainerLSP: React.FunctionComponent = () => {
6
7
const { state } = useOvermind ( ) ;
7
8
const [ containerLSP , setContainerLSP ] = useState ( false ) ;
8
9
useEffect ( ( ) => {
9
- const value = window . localStorage . getItem ( 'CONTAINER_LSP' ) ;
10
-
11
- if ( value === 'true' ) {
10
+ if ( CONTAINER_LSP === 'true' ) {
12
11
return setContainerLSP ( true ) ;
13
12
}
14
13
return setContainerLSP ( false ) ;
Original file line number Diff line number Diff line change
1
+ import { REDESIGNED_SIDEBAR } from '@codesandbox/common/lib/utils/feature-flags' ;
1
2
import React , { useState , useEffect } from 'react' ;
2
3
3
4
import { SubDescription , PaddedPreference } from '../elements' ;
4
5
5
6
export const NewSidebar : React . FunctionComponent = ( ) => {
6
7
const [ newSidebar , setNewSidebar ] = useState ( false ) ;
7
8
useEffect ( ( ) => {
8
- const value = window . localStorage . getItem ( 'REDESIGNED_SIDEBAR' ) ;
9
-
10
- if ( value === 'true' ) {
9
+ if ( REDESIGNED_SIDEBAR === 'true' ) {
11
10
return setNewSidebar ( true ) ;
12
11
}
13
12
return setNewSidebar ( false ) ;
Original file line number Diff line number Diff line change @@ -319,9 +319,6 @@ export type Sandbox = {
319
319
userLiked : boolean ;
320
320
modules : Module [ ] ;
321
321
directories : Directory [ ] ;
322
- featureFlags : {
323
- [ key : string ] : boolean ;
324
- } ;
325
322
collection ?: {
326
323
path : string ;
327
324
} ;
@@ -448,10 +445,10 @@ export type PackageJSON = {
448
445
keywords ?: string [ ] ;
449
446
main ?: string ;
450
447
module ?: string ;
451
- scripts ?: { [ command : string ] : string ; } ;
452
- dependencies ?: { [ dependency : string ] : string ; } ;
453
- devDependencies ?: { [ dependency : string ] : string ; } ;
454
- jest ?: { setupFilesAfterEnv ?: string [ ] ; } ;
448
+ scripts ?: { [ command : string ] : string } ;
449
+ dependencies ?: { [ dependency : string ] : string } ;
450
+ devDependencies ?: { [ dependency : string ] : string } ;
451
+ jest ?: { setupFilesAfterEnv ?: string [ ] } ;
455
452
resolutions ?: { [ dependency : string ] : string } ;
456
453
} ;
457
454
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ /**
2
+ poor man's feature flags
3
+
4
+ you can export a constant which enables/disables a feature
5
+
6
+ it's a TS file, so you can add whatever logic you want as long as it's static
7
+ */
8
+
9
+ export const CONTAINER_LSP = localStorage . getItem ( 'CONTAINER_LSP' ) || false ;
10
+ export const REDESIGNED_SIDEBAR =
11
+ localStorage . getItem ( 'REDESIGNED_SIDEBAR' ) || false ;
You can’t perform that action at this time.
0 commit comments