Skip to content

Commit

Permalink
fix: 修复聊天时的性能问题
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmclin2 committed Oct 5, 2024
1 parent 5a4c3b5 commit f2e1272
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/app/chat/ChatHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { Skeleton, Space } from 'antd';
import classNames from 'classnames';
import { isEqual } from 'lodash-es';
import React, { Suspense } from 'react';
import { Flexbox } from 'react-layout-kit';

Expand All @@ -22,7 +23,7 @@ interface Props {
export default (props: Props) => {
const { className, style } = props;
const { styles } = useStyles();
const [currentAgent] = useSessionStore((s) => [sessionSelectors.currentAgent(s)]);
const [currentAgent] = useSessionStore((s) => [sessionSelectors.currentAgent(s)], isEqual);

return (
<Flexbox
Expand Down
9 changes: 5 additions & 4 deletions src/app/chat/ViewerMode/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import classNames from 'classnames';
import { isEqual } from 'lodash-es';
import React, { memo } from 'react';
import { Flexbox } from 'react-layout-kit';

Expand All @@ -14,10 +15,10 @@ import { useStyles } from './style';

export default memo(() => {
const { styles } = useStyles();
const [currentAgent, interactive] = useSessionStore((s) => [
sessionSelectors.currentAgent(s),
s.interactive,
]);
const [currentAgent, interactive] = useSessionStore(
(s) => [sessionSelectors.currentAgent(s), s.interactive],
isEqual,
);

return (
<Flexbox flex={1} style={{ position: 'relative' }}>
Expand Down

0 comments on commit f2e1272

Please sign in to comment.