Просмотр исходного кода

refactor: memoize SelectablePageTree component for performance optimization

Shun Miyazawa 8 месяцев назад
Родитель
Сommit
6f6a7ee9e9

+ 2 - 2
apps/app/src/features/openai/client/components/AiAssistant/AiAssistantManagementModal/AiAssistantManagementPageTreeSelection.tsx

@@ -33,7 +33,7 @@ export const isIPageHasId = (value?: IPageForItem): value is IPageHasId => {
 };
 
 
-const SelectablePageTree = (props: { onClickAddPageButton: (page: IPageHasId) => void }) => {
+const SelectablePageTree = memo((props: { onClickAddPageButton: (page: IPageHasId) => void }) => {
   const { onClickAddPageButton } = props;
 
   const { data: isGuestUser } = useIsGuestUser();
@@ -84,7 +84,7 @@ const SelectablePageTree = (props: { onClickAddPageButton: (page: IPageHasId) =>
       CustomTreeItem={PageTreeItem}
     />
   );
-};
+});
 
 
 export const AiAssistantManagementPageTreeSelection = (): JSX.Element => {