diff --git a/packages/bruno-app/src/components/EnvironmentVariablesTable/index.js b/packages/bruno-app/src/components/EnvironmentVariablesTable/index.js index f0fe61904..c1f05712a 100644 --- a/packages/bruno-app/src/components/EnvironmentVariablesTable/index.js +++ b/packages/bruno-app/src/components/EnvironmentVariablesTable/index.js @@ -495,7 +495,14 @@ const EnvironmentVariablesTable = ({ placeholder={isLastEmptyRow ? 'Value' : ''} isSecret={variable.secret} readOnly={typeof variable.value !== 'string'} - onChange={(newValue) => formik.setFieldValue(`${actualIndex}.value`, newValue, true)} + onChange={(newValue) => { + formik.setFieldValue(`${actualIndex}.value`, newValue, true); + // Clear ephemeral metadata when user manually edits the value + if (variable.ephemeral) { + formik.setFieldValue(`${actualIndex}.ephemeral`, undefined, false); + formik.setFieldValue(`${actualIndex}.persistedValue`, undefined, false); + } + }} onSave={handleSave} /> diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js index fdadf4746..2a048b008 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js @@ -2063,7 +2063,14 @@ export const updateVariableInScope = (variableName, newValue, scopeInfo, collect return reject(new Error('Variable not found')); } - const updatedVariables = environment.variables.map((v) => (v.uid === variable.uid ? { ...v, value: newValue } : v)); + const updatedVariables = environment.variables.map((v) => { + if (v.uid === variable.uid) { + // Clear ephemeral metadata when user manually edits the value + const { ephemeral, persistedValue, ...rest } = v; + return { ...rest, value: newValue }; + } + return v; + }); return dispatch(saveEnvironment(updatedVariables, environment.uid, collectionUid)) .then(() => { @@ -2172,8 +2179,14 @@ export const updateVariableInScope = (variableName, newValue, scopeInfo, collect return reject(new Error('Variable not found')); } - const updatedVariables = environment.variables.map((v) => - v.uid === variable.uid ? { ...v, value: newValue } : v); + const updatedVariables = environment.variables.map((v) => { + if (v.uid === variable.uid) { + // Clear ephemeral metadata when user manually edits the value + const { ephemeral, persistedValue, ...rest } = v; + return { ...rest, value: newValue }; + } + return v; + }); return dispatch(saveGlobalEnvironment({ variables: updatedVariables, environmentUid: activeGlobalEnvUid })) .then(() => {