forked from farhoodlabs/paperclip
fix(ui): preserve env var when switching type from Plain to Secret
When changing an env var's type from Plain to Secret in the agent config form, the row was silently dropped because emit() skipped secret rows without a secretId. This caused data loss — the variable disappeared from both the UI and the saved config. Fix: keep the row as a plain binding during the transition state until the user selects an actual secret. This preserves the key and value so nothing is lost. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1170,8 +1170,12 @@ function EnvVarEditor({
|
||||
const k = row.key.trim();
|
||||
if (!k) continue;
|
||||
if (row.source === "secret") {
|
||||
if (!row.secretId) continue;
|
||||
rec[k] = { type: "secret_ref", secretId: row.secretId, version: "latest" };
|
||||
if (row.secretId) {
|
||||
rec[k] = { type: "secret_ref", secretId: row.secretId, version: "latest" };
|
||||
} else {
|
||||
// Preserve as plain during transition to avoid data loss
|
||||
rec[k] = { type: "plain", value: row.plainValue };
|
||||
}
|
||||
} else {
|
||||
rec[k] = { type: "plain", value: row.plainValue };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user