From a36c3c5399659a03740b0b60cadc8db30c370732 Mon Sep 17 00:00:00 2001 From: Haze <709547807@qq.com> Date: Fri, 6 Feb 2026 03:50:23 +0800 Subject: [PATCH] fix(stores): channels.status and skills.status return complex objects, not arrays The Dashboard crashed with 'channels.slice is not a function' because channels.status returns a deeply nested object per channel ID, not a Channel[] array. Same issue with skills.status. For now, use empty arrays since channel/skill management is deferred to their dedicated pages. Will properly parse the complex response format when those pages are implemented. --- src/stores/channels.ts | 29 ++++------------------------- src/stores/skills.ts | 29 ++++------------------------- 2 files changed, 8 insertions(+), 50 deletions(-) diff --git a/src/stores/channels.ts b/src/stores/channels.ts index 8ec9dd323..820c7a8c1 100644 --- a/src/stores/channels.ts +++ b/src/stores/channels.ts @@ -34,31 +34,10 @@ export const useChannelsStore = create((set, get) => ({ error: null, fetchChannels: async () => { - set({ loading: true, error: null }); - - try { - // OpenClaw uses channels.status to get channel information - const result = await window.electron.ipcRenderer.invoke( - 'gateway:rpc', - 'channels.status', - {} - ) as { success: boolean; result?: { channels?: Channel[] } | Channel[]; error?: string }; - - if (result.success && result.result) { - // Handle both array and object response formats - const channels = Array.isArray(result.result) - ? result.result - : (result.result.channels || []); - set({ channels, loading: false }); - } else { - // Don't show error for unsupported methods - just use empty list - set({ channels: [], loading: false }); - } - } catch (error) { - // Gateway might not support this method yet - gracefully degrade - console.warn('Failed to fetch channels:', error); - set({ channels: [], loading: false }); - } + // channels.status returns a complex nested object, not a simple array. + // Channel management is deferred to Settings > Channels page. + // For now, just use empty list - channels will be added later. + set({ channels: [], loading: false }); }, addChannel: async (params) => { diff --git a/src/stores/skills.ts b/src/stores/skills.ts index 841a74304..2aea6d2b1 100644 --- a/src/stores/skills.ts +++ b/src/stores/skills.ts @@ -24,31 +24,10 @@ export const useSkillsStore = create((set, get) => ({ error: null, fetchSkills: async () => { - set({ loading: true, error: null }); - - try { - // OpenClaw uses skills.status to get skill information - const result = await window.electron.ipcRenderer.invoke( - 'gateway:rpc', - 'skills.status', - {} - ) as { success: boolean; result?: { skills?: Skill[] } | Skill[]; error?: string }; - - if (result.success && result.result) { - // Handle both array and object response formats - const skills = Array.isArray(result.result) - ? result.result - : (result.result.skills || []); - set({ skills, loading: false }); - } else { - // Don't show error for unsupported methods - just use empty list - set({ skills: [], loading: false }); - } - } catch (error) { - // Gateway might not support this method yet - gracefully degrade - console.warn('Failed to fetch skills:', error); - set({ skills: [], loading: false }); - } + // skills.status returns a complex nested object, not a simple Skill[] array. + // Skill management is handled in the Skills page. + // For now, use empty list - will be properly integrated later. + set({ skills: [], loading: false }); }, enableSkill: async (skillId) => {