mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-26 10:45:57 +08:00
fix(core): infinitied loop (#13653)
Fix #13649 #### PR Dependency Tree * **PR #13653** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Streamlined internal async handling to depend only on specified inputs, reducing unnecessary updates and improving responsiveness. * Preserved existing error handling for async operations. * **Chores** * Adjusted lint configuration/comments to align with the updated dependency strategy, reducing false-positive warnings. No user-facing UI changes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -22,8 +22,9 @@ export function useAsyncCallback<T extends any[]>(
|
|||||||
const handleAsyncError = React.useContext(AsyncCallbackContext);
|
const handleAsyncError = React.useContext(AsyncCallbackContext);
|
||||||
return React.useCallback(
|
return React.useCallback(
|
||||||
(...args: any) => {
|
(...args: any) => {
|
||||||
|
// oxlint-disable-next-line exhaustive-deps
|
||||||
callback(...args).catch(e => handleAsyncError(e));
|
callback(...args).catch(e => handleAsyncError(e));
|
||||||
},
|
},
|
||||||
[callback, handleAsyncError, ...deps] // eslint-disable-line react-hooks/exhaustive-deps
|
[...deps] // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user