-
-
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
Add possibility to manually unsubscribe from useLazyQuery #2055 #2133
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1a40475:
|
✅ Deploy Preview for redux-starter-kit-docs ready! 🔨 Explore the source changes: 1a40475 🔍 Inspect the deploy log: https://app.netlify.com/sites/redux-starter-kit-docs/deploys/6234eb2c12d4cf0008f84be1 😎 Browse the preview: https://deploy-preview-2133--redux-starter-kit-docs.netlify.app |
const info = useMemo(() => ({ lastArg: arg }), [arg]) | ||
return useMemo( | ||
() => [trigger, queryStateResults, info], | ||
[trigger, queryStateResults, info] | ||
() => [trigger, queryStateResults, info, unsubscribe], | ||
[trigger, queryStateResults, info, unsubscribe] |
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.
I would suggest to make unsubscribe
part of the info
object and maybe give it a better name. Open to suggestions.
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's some good advice, I missed the fact that info
was already an object for some extra things so I can touch it without breaking anything 😄 not sure if extras
is the best possible name though, waiting for further feedback!
We just did a grooming of PRs and discussed this: would you be okay to to a PR for a It feels inconsistent to us that after unsubscribing, the query state will still stay in the component for another 60 seconds - or even forever, if another component is still using it. Or do you have a good use case that would only make sense with |
This is exactly what I am looking for I think. I am using useLazyQuery with query params given by user. Is this possible somehow already? |
@henkkasoft it will not remove the value, just unsubscribe from it. It will be removed after 60 second if no other component uses it. Maybe you are giving |
Hi, I see that there was no activity on this PR for a while now. Is this still pending? I would be happy to take over this PR and implement the above mentioned |
@stchristian yeah, no one has looked at this in a year. Might be best to re-create it and file a new PR with the updates |
@markerikson Before starting this feature, I would suggest adding a |
I solved my problem earlier so that after showing input-error modal I stored startedTimeStamp so that unless it it changed the modal is not shown again. It worked nice even the reseting was not possible... until now. My guess is that the encountered problem now is this: It is really confusing for the user that some old input error from advanced search is shown again when doing some modification elsewhere in the app. In our app the advanced search can be open in the app and still other tasks can be performed. So it is not uncommon to try to search something but fail the search and continue usage so that the latest advanced search is left open and that is why the reseting or atleast unsubscribing this lazy query would be important to be able to perform. Any updates on this PR / issue #2055 ? |
I was able to prevent invalidation of the query in isError state by adding error check to providesTags function: Not sure if this is still the best solution... |
Replaced by #4689 |
Related to issue #2055