mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix(variables): drop the key from the draft map before writing it
A rejected update left its key in vars, so the second pass picked it up as a new variable and resent the stored key — the exact call the sparse update is meant to avoid for keys that predate the identifier rule.
This commit is contained in:
1 parent
1d4cfad9fa
commit
0feeb2a627
1 file changed
+5
-1
@@ -152,6 +152,11 @@
|
||||
editableVariables.map(async (variable) => {
|
||||
const newValue = vars[variable.key] ?? null;
|
||||
|
||||
// Claim the key up front. A rejected write must not leave it
|
||||
// behind for the second pass, which would retry it as a new
|
||||
// variable and send the stored key along with it.
|
||||
delete vars[variable.key];
|
||||
|
||||
if (newValue === null) {
|
||||
await sdkDeleteVariable(variable.$id);
|
||||
} else if (newValue !== variable.value) {
|
||||
@@ -159,7 +164,6 @@
|
||||
// the API keep the stored one.
|
||||
await sdkUpdateVariable(variable.$id, undefined, newValue, false);
|
||||
}
|
||||
delete vars[variable.key];
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user