mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 01:36:27 +00:00
refactor(BlockRequestProvider): add memo function
This commit is contained in:
parent
ed1a585cd5
commit
1fcf83f37d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user