UI: preserve empty raw config resets

This commit is contained in:
Val Alexander
2026-04-21 20:25:53 -05:00
parent 24556b3cdc
commit 49fa565ba6
3 changed files with 23 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ Docs: https://docs.openclaw.ai
- Discord: keep slash command follow-up chunks ephemeral when the command is configured for ephemeral replies, so long `/status` output no longer leaks fallback model or runtime details into the public channel. (#69869) thanks @gumadeiras.
- Plugins/discovery: reject package plugin source entries that escape the package directory before explicit runtime entries or inferred built JavaScript peers can be used. (#69868) thanks @gumadeiras.
- CLI/channels: resolve channel presence through a shared policy that keeps ambient env vars and stale persisted auth from surfacing disabled bundled plugins in status, doctor, security audit, and cron delivery validation unless the channel or plugin is effectively enabled or explicitly configured. (#69862) Thanks @gumadeiras.
- Control UI/config: preserve intentionally empty raw config snapshots when clearing pending updates so reset restores the original bytes instead of synthesizing JSON for blank config files. (#68178) Thanks @BunsDev.
### Fixes

View File

@@ -185,6 +185,27 @@ describe("resetConfigPendingChanges", () => {
expect(state.configForm).toEqual({ gateway: { mode: "local" } });
expect(state.configRaw).toBe('{\n "gateway": { "mode": "local" }\n}\n');
});
it("preserves an intentionally empty original raw config", () => {
const state = createState();
state.configSnapshot = {
config: {},
valid: true,
issues: [],
raw: "",
};
state.configFormOriginal = {};
state.configRawOriginal = "";
state.configForm = { gateway: { mode: "remote" } };
state.configRaw = '{\n "gateway": { "mode": "remote" }\n}\n';
state.configFormDirty = true;
resetConfigPendingChanges(state);
expect(state.configFormDirty).toBe(false);
expect(state.configForm).toEqual({});
expect(state.configRaw).toBe("");
});
});
describe("agent config helpers", () => {

View File

@@ -223,7 +223,7 @@ export function resetConfigPendingChanges(state: ConfigState) {
state.configFormOriginal ?? state.configSnapshot?.config ?? {},
);
state.configRaw =
state.configRawOriginal ||
state.configRawOriginal ??
serializeConfigForm(state.configFormOriginal ?? state.configSnapshot?.config ?? {});
state.configFormDirty = false;
}