-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat: add refetch on reconnect functionality #919
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
feat: add refetch on reconnect functionality #919
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/tannerlinsley/react-query/f9gnm5vxe |
91e5836
to
ec7c633
Compare
ec7c633
to
03dbb92
Compare
🎉 This PR is included in version 2.12.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
isCancelledError, | ||
isError, | ||
setConsole, | ||
stableStringify, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@boschni could you explain why stableStringify
is no longer exposed? I realize this util was not documented, it was a part of the public interface exposed by the library and it ended up being a breaking change for us... It was convenient for key comparison...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! It has been removed because it is an undocumented internal function which happened to be used for key serialization (it was also not exposed as a key serialization function). Could you explain a bit more about your use case? Then we might be able to come up with a proper API for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@boschni Thanks for the reply! Our use-case is simple. We have some generic functionality in our app, which wraps react query, and simply wants to detect if the query key has changed. Because keys can be heterogeneous in structure, there is no good way to compare them. We could deep compare the objects on our own, but that requires pulling in a separate implementation, and more importantly risks not fully aligning with the comparison logic used by react-query
. We assumed that since the serialization routine was exported, it was effectively the supported if undocumented approach @tannerlinsley had exposed to do just that.
I realize that you can rightly view these utils as a leaky abstraction, and truly appreciate all the work you guys are doing, but just a kind request as a semver consideration for the future:
Since the removed utils were a part of the external interface, it seems more appropriate to reserve the cleanup for a major version, with at least a comment on the PR explaining the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added getDefaultReactQueryConfig()
in #1001 which can be to get the default queryKeySerializerFn
. Would that be sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds awesome! Will check it out on Monday. Thanks so much for adding it so quickly!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@boschni We've switched using the new method you added & it works great! Thanks again!
No description provided.