-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
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
[enhance] use the latest version of the config callbacks #515
Comments
cc @shuding |
This looks like a good idea, would you like to send a PR with the change? It would even great to run the whole test suite against it and probably add a few tests to ensure it works as you expect |
@sergiodxa |
I've been struggling with an issue because of this, i'm relying on some redux state that gets updated a lot in the onError callback, and the fact that it only capture and and save the callback on first render made it impossible to get around the issue with a clean solution, so this fix would save a lot for me. thanks |
Related issue: #508
Currently,the config callbacks captured by the
eventsRef
is the callbacks created in the initial render of the component.If the config callbacks is pure, everything is fine.
but if the config callbacks rely on some variables of the components , it would cause some bugs related to the stale closure.
solution
I think if the
useSWR
hook read the config callbacks viauseRef
would be great, but this may bring some bugs if some APP rely on the current behavior of the config callbacks.what do you think?
The text was updated successfully, but these errors were encountered: