fix: save a cleared variable value instead of keeping the old one (#12466)

Updating a variable sent no value whenever the field was empty, so
clearing a non-secret value (or a loaded secret) and clicking Update
reported success but kept the stored value. Only skip the value when the
baseline is empty too, which is the case of a secret never loaded.
This commit is contained in:
Raunak Burrows
2026-11-17 06:32:36 +00:00
committed by GitHub
parent 3ce2acfbe5
commit bd266bc3ba
@@ -458,13 +458,10 @@
path: ini.path,
requestBody: {
path: ini.path != s.path ? s.path : undefined,
// An empty value keeps the stored one, except when it replaces a
// reference: the reference is then dropped for the empty value.
// An empty value keeps the stored one only while the baseline is empty too
// (a secret never loaded): clearing a value or reference that was shown saves it empty.
value:
s.variable.value == '' &&
!(isExternalRef(ini.variable.value) && !isExternalRef(s.variable.value))
? undefined
: s.variable.value,
s.variable.value == '' && ini.variable.value == '' ? undefined : s.variable.value,
is_secret:
ini.variable.is_secret != s.variable.is_secret ? s.variable.is_secret : undefined,
description: