Skip to content

Commit 3f4b422

Browse files
committed
fix(react-client): define chatSettingsValue type at least roughly
1 parent c5b5e1b commit 3f4b422

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

libs/react-client/src/store/chat.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface ChatState {
1818
chatProfile?: string;
1919
chatSettingsInputs: any[];
2020
chatSettingsDefaultValue: any;
21-
chatSettingsValue: any;
21+
chatSettingsValue: Record<any, any>;
2222

2323
setIsAiSpeaking: (isAiSpeaking: boolean) => void;
2424
setAudioConnection: (audioConnection: 'connecting' | 'on' | 'off') => void;
@@ -42,7 +42,7 @@ interface ChatState {
4242
) => void;
4343
setChatProfile: (chatProfile: string) => void;
4444
setChatSettingsInputs: (chatSettingsInputs: any[]) => void;
45-
setChatSettingsValue: (chatSettingsValue: any) => void;
45+
setChatSettingsValue: (chatSettingsValue: Record<any, any>) => void;
4646
resetChatSettingsInputs: () => void;
4747
resetChatSettingsValue: () => void;
4848
}
@@ -110,13 +110,13 @@ export const useChatStore = create<ChatState>((set, get) => ({
110110
}
111111
}));
112112

113-
// useChatStore.subscribe((state, prevState) => {
114-
// const chatSettingsDefaultValue = state.chatSettingsInputs.reduce(
115-
// (form: { [key: string]: any }, input: any) => (
116-
// (form[input.id] = input.initial), form
117-
// ),
118-
// {}
119-
// );
120-
//
121-
// useChatStore.setState({chatSettingsDefaultValue });
122-
// })
113+
useChatStore.subscribe((state) => {
114+
const chatSettingsDefaultValue = state.chatSettingsInputs.reduce(
115+
(form: { [key: string]: any }, input: any) => (
116+
(form[input.id] = input.initial), form
117+
),
118+
{}
119+
);
120+
121+
useChatStore.setState({ chatSettingsDefaultValue });
122+
});

0 commit comments

Comments
 (0)