diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSelector/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSelector/index.js index ac1ec69261..2e93c2c693 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSelector/index.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSelector/index.js @@ -1,4 +1,4 @@ -import React, { useRef, forwardRef, useState, useEffect } from 'react'; +import React, { useRef, forwardRef, useState } from 'react'; import find from 'lodash/find'; import Dropdown from 'components/Dropdown'; import { selectEnvironment } from 'providers/ReduxStore/slices/collections/actions'; @@ -8,16 +8,19 @@ import toast from 'react-hot-toast'; import { useDispatch } from 'react-redux'; import StyledWrapper from './StyledWrapper'; -const EnvironmentSelector = ({ collection }) => { +const EnvironmentSelector = (props) => { const dispatch = useDispatch(); const dropdownTippyRef = useRef(); const [openSettingsModal, setOpenSettingsModal] = useState(false); - const { activeEnvironmentUid } = collection; - const [environments, setEnvironments] = useState(collection.environments); - useEffect(() => { - console.log('useEffect EnvironmentSelector'); - }, [environments]); - const activeEnvironment = activeEnvironmentUid ? find(environments, (e) => e.uid === activeEnvironmentUid) : null; + const { activeEnvironmentUid } = props.collection; + const [collection, setCollection] = useState(props.collection); + const setEnvironments = (environments) => { + setCollection({ ...collection, environments: environments }); + }; + + const activeEnvironment = activeEnvironmentUid + ? find(collection.environments, (e) => e.uid === activeEnvironmentUid) + : null; const Icon = forwardRef((props, ref) => { return ( @@ -50,8 +53,8 @@ const EnvironmentSelector = ({ collection }) => {
} placement="bottom-end"> - {environments && environments.length - ? environments.map((e) => ( + {collection.environments?.length + ? collection.environments.map((e) => (
{ {openSettingsModal && ( setOpenSettingsModal(false)} /> diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentColor/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentColor/index.js index 3974b09210..fd6f88b221 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentColor/index.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentColor/index.js @@ -43,7 +43,6 @@ const EnvironmentColor = ({ environment, onColorChange, collectionUid }) => { } }, [formik.values.color]); - console.log(environment.color); return ( { // check env delete if (prevEnvUids?.length && envUids.length < prevEnvUids.length) { - setSelectedEnvironment(collection.environments?.length ? environments[0] : null); + setSelectedEnvironment(collection.environments?.length ? collection.environments[0] : null); } }, [envUids, collection, prevEnvUids]); diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js index 3f08c06309..3c8979c270 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js @@ -1,5 +1,5 @@ import Modal from 'components/Modal/index'; -import React, { useState, useEffect } from 'react'; +import React, { useState } from 'react'; import CreateEnvironment from './CreateEnvironment'; import EnvironmentList from './EnvironmentList'; import StyledWrapper from './StyledWrapper'; diff --git a/packages/bruno-lang/v2/src/jsonToEnv.js b/packages/bruno-lang/v2/src/jsonToEnv.js index a7b4a89e71..b35622e6a1 100644 --- a/packages/bruno-lang/v2/src/jsonToEnv.js +++ b/packages/bruno-lang/v2/src/jsonToEnv.js @@ -43,7 +43,6 @@ ${secretVars.join(',\n')} } if (color !== undefined) { - console.log('jsonToEnv color', color); output += `color: ${color} `; }