How to remove subscription?
See original GitHub issueHi, probably a dumb question, but I didnāt find the answer for it yet. How do I force unsubscribtion using react hooks?
i.e. I have this functional component
function ({ query, queryType }) {
const [result] = useSubscription({
query: query,
})
const data = result.data && result.data[queryType];
useEffect(() => {
console.log("unsubscribe from previous sub")
}, [queryType])
return data ? <Component data={data} /> : <>No data</>
}
I want to unsubscribe from previous subscription, when queryType
changes and useEffect
is triggered.
Is there a way to do it?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
If you want to cancel a subscription from Apple - Apple Support
Open the Settings app. Ā· Tap your name. Ā· Tap Subscriptions. The Subscriptions button in Settings on iPhone. Ā· Tap the subscription. Ā·...
Read more >Cancel, pause, or change a subscription on Google Play
On your Android device, go to your subscriptions in Google Play. Select the subscription you want to cancel. Tap Cancel subscription. Follow the...
Read more >Here's How to Cancel Subscriptions You Forgot About
Cancel the subscriptions by emailing the service providers. If this proves elusive then go through your bank statements going back for 12 monthsĀ ......
Read more >How to cancel Adobe trial or subscription
How to cancel your trial or subscription Ā· Select Manage plan for the plan you want to cancel. Select Manage plan or View...
Read more >Cancel subscriptions | Stripe Documentation
Cancel subscriptions Ā· From the customer account page or the subscription details page, click the overflow menu (. ) Ā· Choose when to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@JoviDeCroock tomorrow we will extract the peace of our current project into separate repo and I will provide the link in this issue
btw in appolo-client there is no problem with unsubscribe, but appolo client has performance issues
Hey @vicsnow
There are no dumb questions š , so on
useQuery
anduseSubscription
we have a property calledpause
that can be passed as an option, similar to how youāre passingquery
at this time.Letās say you want to pause when
queryType
is not āsubā then we can do:Now the
subscription
will be torn down until you unpause it.Linearly, if your query is dependent on variables it will unsubscribe and resubscribe to the new variables when you change them.