We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const { runAsync: runEditBeam } = useRequest( params => { return beamSetData?.treatmentTechnique === TreatmentTechnique.PencilBeamScanning ? editBeam(params) : editUSBeam(params) }, { manual: true, ready: !isNil(beamSetData), onSuccess: () => { dispatch(versionActions.setVersion()) }, }, )
runEditBeam方法会透穿给子组件。 在子组件销毁(当前组件也会)时,执行runEditBeam方法,会出现onSuccess不执行的异常。 同时,子组件中的try runEditBeam catch也被吃掉。
The text was updated successfully, but these errors were encountered:
按照ahooks官网网站的介绍,组件卸载时,onSuccess确实是不执行的:
Sorry, something went wrong.
hooks官网网站的介绍,组件卸载时
sorry,没注意到。
但是在一些场景下,就不好用了。 比如将方法交给input控件的onBlur事件,
这时,组件的销毁,触发onblur事件。
但是这个onSuccess方法将不再会在触发了。 这不好用
不好用
同感。比较常见的场景是,在弹窗里,点完确定/取消,希望触发回调方法更新数据时,如果弹窗先关闭(弹窗组件卸载),就无法更新数据了。
暂时先用useCallback或useMemoizedFn方式解决了。
希望大佬么考虑一下-__-
No branches or pull requests
runEditBeam方法会透穿给子组件。
在子组件销毁(当前组件也会)时,执行runEditBeam方法,会出现onSuccess不执行的异常。
同时,子组件中的try runEditBeam catch也被吃掉。
The text was updated successfully, but these errors were encountered: