@@ -92,10 +92,7 @@ export function applySettings(host: SettingsHost, next: UiSettings) {
9292
9393export function setLastActiveSessionKey ( host : SettingsHost , next : string ) {
9494 const trimmed = next . trim ( ) ;
95- if ( ! trimmed ) {
96- return ;
97- }
98- if ( host . settings . lastActiveSessionKey === trimmed ) {
95+ if ( ! trimmed || host . settings . lastActiveSessionKey === trimmed ) {
9996 return ;
10097 }
10198 applySettings ( host , { ...host . settings , lastActiveSessionKey : trimmed } ) ;
@@ -275,44 +272,42 @@ async function refreshAgentsTab(host: SettingsHost, app: OpenClawApp) {
275272 case "cron" :
276273 void loadCron ( host ) ;
277274 return ;
278- default :
279- return ;
280275 }
281276}
282277
283278export async function refreshActiveTab ( host : SettingsHost ) {
284279 const app = host as unknown as OpenClawApp ;
285- if (
286- (
287- [
288- "config" ,
289- "communications" ,
290- "appearance" ,
291- "automation" ,
292- "infrastructure" ,
293- "aiAgents" ,
294- ] as Tab [ ]
295- ) . includes ( host . tab )
296- ) {
297- await loadConfigSchema ( app ) ;
298- await loadConfig ( app ) ;
299- return ;
300- }
301- const simpleTabLoaders : Partial < Record < Tab , ( ) => Promise < void > > > = {
302- overview : ( ) => loadOverview ( host ) ,
303- channels : ( ) => loadChannelsTab ( host ) ,
304- instances : ( ) => loadPresence ( app ) ,
305- usage : ( ) => loadUsage ( app ) ,
306- sessions : ( ) => loadSessions ( app ) ,
307- cron : ( ) => loadCron ( host ) ,
308- skills : ( ) => loadSkills ( app ) ,
309- } ;
310- const simpleTabLoader = simpleTabLoaders [ host . tab ] ;
311- if ( simpleTabLoader ) {
312- await simpleTabLoader ( ) ;
313- return ;
314- }
315280 switch ( host . tab ) {
281+ case "config" :
282+ case "communications" :
283+ case "appearance" :
284+ case "automation" :
285+ case "infrastructure" :
286+ case "aiAgents" :
287+ await loadConfigSchema ( app ) ;
288+ await loadConfig ( app ) ;
289+ return ;
290+ case "overview" :
291+ await loadOverview ( host ) ;
292+ return ;
293+ case "channels" :
294+ await loadChannelsTab ( host ) ;
295+ return ;
296+ case "instances" :
297+ await loadPresence ( app ) ;
298+ return ;
299+ case "usage" :
300+ await loadUsage ( app ) ;
301+ return ;
302+ case "sessions" :
303+ await loadSessions ( app ) ;
304+ return ;
305+ case "cron" :
306+ await loadCron ( host ) ;
307+ return ;
308+ case "skills" :
309+ await loadSkills ( app ) ;
310+ return ;
316311 case "agents" :
317312 await refreshAgentsTab ( host , app ) ;
318313 return ;
@@ -480,9 +475,7 @@ function applyTabSelection(
480475 options : { refreshPolicy : "always" | "connected" ; syncUrl ?: boolean } ,
481476) {
482477 const prev = host . tab ;
483- if ( host . tab !== next ) {
484- host . tab = next ;
485- }
478+ host . tab = next ;
486479
487480 // Cleanup chat module state when navigating away from chat
488481 if ( prev === "chat" && next !== "chat" ) {
0 commit comments