-
Notifications
You must be signed in to change notification settings - Fork 64
feat(query-db-collection): support automatic refetch on query invalidation #381
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This test might need to be changed, open to feedback!
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.
huh wait... did we already have support for invalidating queries?? 😅 It looks like we just added another implementation... it seems Query was already handling this internally... if this is the case, then we have a lot less to do, just update the docs/jsdocs a bit.
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.
Definitely appears so, and to be honest, that's what I've been confused about. Still not completely following the need for refetch in general, if under the hood we're reading from the cache from query? But I don't have full context as well. 😄
I'll go ahead and remove the changes.
If this behavior is handled by Query already, do we want to mention that directly in docs/query-collection.md? What did you have in mind?
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.
Yeah when building this originally and writing this issue it didn't occur to me that the query client would just keep calling the queryFn like normal.
Refetch is nice as not everyone is migrating from a full blown normal Query setup so they might just have a one-off collection that they want to be able to manually refetch. It depends I suppose on your mental model of your state. A web of data or standalone table-like collections.
There's a few places where we mention calling other collections to refetch (search for "refetch". So we should mention first that you can invalidate a tag or just directly tell those collections to refetch.