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:
L-Sun
2025-09-26 16:59:33 +08:00
committed by GitHub
parent e7f76c1737
commit 6af1f6ab8d

View File

@@ -22,8 +22,9 @@ export function useAsyncCallback<T extends any[]>(
const handleAsyncError = React.useContext(AsyncCallbackContext);
return React.useCallback(
(...args: any) => {
// oxlint-disable-next-line exhaustive-deps
callback(...args).catch(e => handleAsyncError(e));
},
[callback, handleAsyncError, ...deps] // eslint-disable-line react-hooks/exhaustive-deps
[...deps] // eslint-disable-line react-hooks/exhaustive-deps
);
}