From 1fcf83f37d96ebefcb5749dbf324b33f6f56ab87 Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Sat, 26 Oct 2024 20:13:37 +0800 Subject: [PATCH] refactor(BlockRequestProvider): add memo function --- .../src/data-source/data-block/DataBlockRequestProvider.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx b/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx index 497053bc01..5e3a87a630 100644 --- a/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx +++ b/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx @@ -96,7 +96,7 @@ export async function requestParentRecordData({ return res.data; } -export const BlockRequestProvider: FC = ({ children }) => { +export const BlockRequestProvider: FC = React.memo(({ children }) => { const props = useDataBlockProps(); const { action, @@ -155,7 +155,9 @@ export const BlockRequestProvider: FC = ({ children }) => { )} ); -}; +}); + +BlockRequestProvider.displayName = 'DataBlockRequestProvider'; export const useDataBlockRequest = (): UseRequestResult<{ data: T }> => { const context = useContext(BlockRequestContext);