Skip to content

Commit

Permalink
♻️ refactor: refactor to support multi chat store
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Nov 14, 2024
1 parent 7548ac3 commit 3f262f4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ const Content = memo<ListProps>(({ mobile }) => {
return <VirtualizedList dataSource={data} mobile={mobile} />;
});

Content.displayName = 'ChatListRender';

export default Content;
4 changes: 2 additions & 2 deletions src/features/Conversation/components/ChatItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ const Item = memo<ChatListItemProps>(({ index, id, hideActionBar, showThreadDivi

const onChange = useCallback((value: string) => updateMessageContent(id, value), [id]);

const onDoubleClick = useCallback<MouseEventHandler>(
const onDoubleClick = useCallback<MouseEventHandler<HTMLDivElement>>(
(e) => {
if (!item) return;
if (item.id === 'default' || item.error) return;
if (item.role && ['assistant', 'user'].includes(item.role) && e.altKey) {
toggleMessageEditing(id, true);
}
},
[item?.role, item?.id, item?.error],
[item],
);

const text = useMemo(
Expand Down
2 changes: 1 addition & 1 deletion src/store/chat/slices/thread/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const chatThreadMessage: StateCreator<
);
},
updateThreadInputMessage: (message) => {
if (isEqual(message, get().inputMessage)) return;
if (isEqual(message, get().threadInputMessage)) return;

set({ threadInputMessage: message }, false, n(`updateThreadInputMessage`, message));
},
Expand Down

0 comments on commit 3f262f4

Please sign in to comment.