refactor(BlockRequestProvider): add memo function

This commit is contained in:
Zeke Zhang 2024-10-26 20:13:37 +08:00
parent ed1a585cd5
commit 1fcf83f37d

View File

@ -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 }) => {
)}
</BlockRequestContext.Provider>
);
};
});
BlockRequestProvider.displayName = 'DataBlockRequestProvider';
export const useDataBlockRequest = <T extends {}>(): UseRequestResult<{ data: T }> => {
const context = useContext(BlockRequestContext);