-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add clear method to Query #275
Conversation
src/Query.ts
Outdated
@@ -93,6 +93,12 @@ export class Query<T = unknown> implements PromiseLike<T> { | |||
} | |||
} | |||
|
|||
clear = (): void => { |
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.
my only potential suggestion here is using clearData
vs. clear
just to make it more clear what you are clearing. clear?
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.
Ok I thought that was clear but we can rename it.
@mattiasewers just one comment, but also curious what use case you are hitting with this |
@mattiasewers Thanks for the PR. Could you explain a bit about what this is helping you solve? I understand you are clearing the data for the Query but I don't quite understand why you need to do this. When we use the |
@chrisdrackett @special-character I'm working on a app for my company where I need to reset the data object without making a another request, I don't know if that is possible currently which is why I made this pr. |
@mattiasewers Thanks for commenting, I get that you need to clear the data I was curious about what the use case was and how you were using the Do you need it to clear the cache or is there another use case that you need this for? |
@special-character Yes I need to clear the cache but only for that |
This is related to the issue #273 which adds a clear method to be able to reset the query to undefined again after fetching.