mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:20:44 +00:00
UI: preserve empty raw config resets
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user