mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-24 21:25:45 +00:00
fix: env var edit (#7066)
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user