fix(ui): use dedicated configSaveError state instead of global lastError
- Add configSaveError field to ChannelsState and AppViewState - Clear configSaveError before save/reload operations - Set configSaveError only when config save fails - Fixes Codex P2 feedback about global error pollution - Channel config callouts now only show save-specific errors
This commit is contained in:
parent
8135ddd566
commit
445328622c
@ -25,12 +25,17 @@ export async function handleWhatsAppLogout(host: OpenClawApp) {
|
||||
}
|
||||
|
||||
export async function handleChannelConfigSave(host: OpenClawApp) {
|
||||
host.configSaveError = null;
|
||||
await saveConfig(host);
|
||||
if (host.lastError) {
|
||||
host.configSaveError = host.lastError;
|
||||
}
|
||||
await loadConfig(host);
|
||||
await loadChannels(host, true);
|
||||
}
|
||||
|
||||
export async function handleChannelConfigReload(host: OpenClawApp) {
|
||||
host.configSaveError = null;
|
||||
await loadConfig(host);
|
||||
await loadChannels(host, true);
|
||||
}
|
||||
|
||||
@ -680,7 +680,7 @@ export function renderApp(state: AppViewState) {
|
||||
configUiHints: state.configUiHints,
|
||||
configSaving: state.configSaving,
|
||||
configFormDirty: state.configFormDirty,
|
||||
configSaveError: state.lastError,
|
||||
configSaveError: state.configSaveError,
|
||||
nostrProfileFormState: state.nostrProfileFormState,
|
||||
nostrProfileAccountId: state.nostrProfileAccountId,
|
||||
onRefresh: (probe) => loadChannels(state, probe),
|
||||
|
||||
@ -145,6 +145,7 @@ export type AppViewState = {
|
||||
channelsSnapshot: ChannelsStatusSnapshot | null;
|
||||
channelsError: string | null;
|
||||
channelsLastSuccess: number | null;
|
||||
configSaveError: string | null;
|
||||
whatsappLoginMessage: string | null;
|
||||
whatsappLoginQrDataUrl: string | null;
|
||||
whatsappLoginConnected: boolean | null;
|
||||
|
||||
@ -240,6 +240,7 @@ export class OpenClawApp extends LitElement {
|
||||
@state() channelsSnapshot: ChannelsStatusSnapshot | null = null;
|
||||
@state() channelsError: string | null = null;
|
||||
@state() channelsLastSuccess: number | null = null;
|
||||
@state() configSaveError: string | null = null;
|
||||
@state() whatsappLoginMessage: string | null = null;
|
||||
@state() whatsappLoginQrDataUrl: string | null = null;
|
||||
@state() whatsappLoginConnected: boolean | null = null;
|
||||
|
||||
@ -12,4 +12,5 @@ export type ChannelsState = {
|
||||
whatsappLoginQrDataUrl: string | null;
|
||||
whatsappLoginConnected: boolean | null;
|
||||
whatsappBusy: boolean;
|
||||
configSaveError: string | null;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user