File tree Expand file tree Collapse file tree 7 files changed +23
-28
lines changed
pages/common/Modals/PreferencesModal/Experiments Expand file tree Collapse file tree 7 files changed +23
-28
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111 SandboxFs ,
1212 Settings ,
1313} from '@codesandbox/common/lib/types' ;
14+ import { CONTAINER_LSP } from '@codesandbox/common/lib/utils/feature-flags' ;
1415import { notificationState } from '@codesandbox/common/lib/utils/notifications' ;
1516import {
1617 NotificationMessage ,
@@ -342,7 +343,7 @@ export class VSCodeEffect {
342343 //
343344 }
344345
345- if ( isServer && this . options . getCurrentUser ( ) ?. experiments . containerLsp ) {
346+ if ( isServer && CONTAINER_LSP === 'true' ) {
346347 childProcess . addDefaultForkHandler ( this . createContainerForkHandler ( ) ) ;
347348 const socket = this . createWebsocketFSRequest ( ) ;
348349 const cache = await this . createFileSystem ( 'WebsocketFS' , {
Original file line number Diff line number Diff line change 88 WindowOrientation ,
99} from '@codesandbox/common/lib/types' ;
1010import { getTextOperation } from '@codesandbox/common/lib/utils/diff' ;
11+ import { CONTAINER_LSP } from '@codesandbox/common/lib/utils/feature-flags' ;
1112import { convertTypeToStatus } from '@codesandbox/common/lib/utils/notifications' ;
1213import { Action , AsyncAction } from 'app/overmind' ;
1314import { withLoadApp , withOwnedSandbox } from 'app/overmind/factories' ;
@@ -120,11 +121,7 @@ export const sandboxChanged: AsyncAction<{ id: string }> = withLoadApp<{
120121 state . editor . modulesByPath = fs ;
121122 } ) ;
122123
123- if (
124- sandbox . featureFlags &&
125- sandbox . featureFlags . containerLsp &&
126- ! sandbox . owned
127- ) {
124+ if ( CONTAINER_LSP === 'true' && ! sandbox . owned ) {
128125 effects . vscode . setReadOnly ( true ) ;
129126 effects . notificationToast . add ( {
130127 message :
Original file line number Diff line number Diff line change 1+ import { CONTAINER_LSP } from '@codesandbox/common/lib/utils/feature-flags' ;
12import React , { useState , useEffect } from 'react' ;
23import { useOvermind } from 'app/overmind' ;
34import { SubDescription , PaddedPreference } from '../elements' ;
@@ -6,9 +7,7 @@ export const ContainerLSP: React.FunctionComponent = () => {
67 const { state } = useOvermind ( ) ;
78 const [ containerLSP , setContainerLSP ] = useState ( false ) ;
89 useEffect ( ( ) => {
9- const value = window . localStorage . getItem ( 'CONTAINER_LSP' ) ;
10-
11- if ( value === 'true' ) {
10+ if ( CONTAINER_LSP === 'true' ) {
1211 return setContainerLSP ( true ) ;
1312 }
1413 return setContainerLSP ( false ) ;
Original file line number Diff line number Diff line change 1+ import { REDESIGNED_SIDEBAR } from '@codesandbox/common/lib/utils/feature-flags' ;
12import React , { useState , useEffect } from 'react' ;
23
34import { SubDescription , PaddedPreference } from '../elements' ;
45
56export const NewSidebar : React . FunctionComponent = ( ) => {
67 const [ newSidebar , setNewSidebar ] = useState ( false ) ;
78 useEffect ( ( ) => {
8- const value = window . localStorage . getItem ( 'REDESIGNED_SIDEBAR' ) ;
9-
10- if ( value === 'true' ) {
9+ if ( REDESIGNED_SIDEBAR === 'true' ) {
1110 return setNewSidebar ( true ) ;
1211 }
1312 return setNewSidebar ( false ) ;
Original file line number Diff line number Diff line change @@ -319,9 +319,6 @@ export type Sandbox = {
319319 userLiked : boolean ;
320320 modules : Module [ ] ;
321321 directories : Directory [ ] ;
322- featureFlags : {
323- [ key : string ] : boolean ;
324- } ;
325322 collection ?: {
326323 path : string ;
327324 } ;
@@ -448,10 +445,10 @@ export type PackageJSON = {
448445 keywords ?: string [ ] ;
449446 main ?: string ;
450447 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 [ ] } ;
455452 resolutions ?: { [ dependency : string ] : string } ;
456453} ;
457454
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