Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(chat-input): preserve default action lists (#18993)

Arvin Xud03b7e3ca751
diff --git a/src/features/ChatInput/store/action.test.ts b/src/features/ChatInput/store/action.test.ts
index 48913becc96..c264e3bfe21 100644
--- a/src/features/ChatInput/store/action.test.ts
+++ b/src/features/ChatInput/store/action.test.ts
@@ -16,6 +16,13 @@ describe('ChatInput store actions', () => {
vi.restoreAllMocks();
});
+ it('keeps action lists usable when a host omits them', () => {
+ const store = createStore({ leftActions: undefined, rightActions: undefined });
+
+ expect(store.getState().leftActions).toEqual([]);
+ expect(store.getState().rightActions).toEqual([]);
+ });
+
it('clears the autocomplete breaker when dismissing its error', () => {
const store = createStore();
diff --git a/src/features/ChatInput/store/action.ts b/src/features/ChatInput/store/action.ts
index 1de75bdb6c9..c5081bb7908 100644
--- a/src/features/ChatInput/store/action.ts
+++ b/src/features/ChatInput/store/action.ts
@@ -41,6 +41,8 @@ const getEffectiveAgentId = (agentId?: string): string => {
export const store: CreateStore = (publicState) => (set, get) => ({
...initialState,
...publicState,
+ leftActions: publicState?.leftActions ?? initialState.leftActions,
+ rightActions: publicState?.rightActions ?? initialState.rightActions,
clearInputCompletionError: () => {
set({ inputCompletionError: undefined, inputCompletionErrorDismissed: false });