mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 03:35:10 +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;
|
return res.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BlockRequestProvider: FC = ({ children }) => {
|
export const BlockRequestProvider: FC = React.memo(({ children }) => {
|
||||||
const props = useDataBlockProps();
|
const props = useDataBlockProps();
|
||||||
const {
|
const {
|
||||||
action,
|
action,
|
||||||
@ -155,7 +155,9 @@ export const BlockRequestProvider: FC = ({ children }) => {
|
|||||||
)}
|
)}
|
||||||
</BlockRequestContext.Provider>
|
</BlockRequestContext.Provider>
|
||||||
);
|
);
|
||||||
};
|
});
|
||||||
|
|
||||||
|
BlockRequestProvider.displayName = 'DataBlockRequestProvider';
|
||||||
|
|
||||||
export const useDataBlockRequest = <T extends {}>(): UseRequestResult<{ data: T }> => {
|
export const useDataBlockRequest = <T extends {}>(): UseRequestResult<{ data: T }> => {
|
||||||
const context = useContext(BlockRequestContext);
|
const context = useContext(BlockRequestContext);
|
||||||
|
Loading…
Reference in New Issue
Block a user