fix: env var edit (#7066)

This commit is contained in:
Pooja
2026-02-19 14:59:53 +05:30
committed by GitHub
parent cb716e5978
commit ab2a16ac05
2 changed files with 24 additions and 4 deletions

View File

@@ -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>

View File

@@ -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(() => {