1+ import { useOvermind } from 'app/overmind' ;
12import React , { useEffect } from 'react' ;
2- import { inject , observer } from 'app/componentConnectors' ;
33
44import { WorkspaceInputContainer } from '../../../elements' ;
5-
65import { EnvEntry } from './EnvEntry' ;
76import { EnvModal } from './EnvModal' ;
87
9- const EnvironmentVariablesComponent = ( { signals : { editor } , store } ) => {
8+ export const EnvironmentVariables : React . FC < { } > = props => {
9+ const {
10+ actions : { editor } ,
11+ state : {
12+ editor : { currentSandbox } ,
13+ } ,
14+ } = useOvermind ( ) ;
1015 useEffect ( ( ) => {
1116 editor . fetchEnvironmentVariables ( ) ;
1217 } , [ editor ] ) ;
@@ -19,7 +24,7 @@ const EnvironmentVariablesComponent = ({ signals: { editor }, store }) => {
1924 editor . deleteEnvironmentVariable ( { name } ) ;
2025 } ;
2126
22- const envVars = store . editor . currentSandbox . environmentVariables ;
27+ const envVars = currentSandbox . environmentVariables ;
2328
2429 if ( ! envVars ) {
2530 return (
@@ -31,17 +36,13 @@ const EnvironmentVariablesComponent = ({ signals: { editor }, store }) => {
3136
3237 return (
3338 < div >
34- { Object . keys ( envVars . toJSON ? envVars . toJSON ( ) : envVars ) . map ( keyName => (
39+ { Object . keys ( envVars ) . map ( keyName => (
3540 < EnvEntry
3641 onSubmit = { createEnv }
3742 onDelete = { deleteEnv }
3843 key = { keyName }
3944 name = { keyName }
40- value = {
41- typeof envVars . get === 'function'
42- ? envVars . get ( keyName )
43- : envVars [ keyName ]
44- }
45+ value = { envVars [ keyName ] }
4546 />
4647 ) ) }
4748
@@ -51,7 +52,3 @@ const EnvironmentVariablesComponent = ({ signals: { editor }, store }) => {
5152 </ div >
5253 ) ;
5354} ;
54-
55- export const EnvironmentVariables = inject ( 'store' , 'signals' ) (
56- observer ( EnvironmentVariablesComponent )
57- ) ;
0 commit comments