[2.0] subscribeToMore unsubscribe after first data | bug
See original GitHub issueI have simple react component with graphql decorator. When component was mounted I am doing subscribeToMore. I will receive first data but immediately after that subscription it stoped working. Component was not unmounted. Am I doing something wrong @jbaxleyiii ? Thank you
@graphql(gql`
query getUserQuestions($username: String!) {
user(username: $username) {
id
questions {
edges {
node {
id
question
}
}
}
}
}
`, {
options: ({ match: { params: { username } } }) => ({
variables: {
username,
},
}),
})
class Test extends Component {
componentWillMount() {
const { subscribeToMore, user } = this.props.data;
this.subscription = subscribeToMore({
document: SubscribeQuestionAddedQuery,
variables: {
username: user.username,
},
updateQuery: (prev, { subscriptionData }) => {
const { data } = subscriptionData;
if (data && data.questionAdded) {
this.questionAdded(data.questionAdded);
}
return prev;
},
});
console.log(this.subscription);
}
...
}
Here you can see frames from websocket:
As you can see command “stop” is send after first data. Component was not unmount.
"apollo-cache-inmemory": "^1.1.1",
"apollo-client": "^2.0.3",
"apollo-link": "^1.0.3",
"apollo-link-http": "^1.2.0",
"apollo-link-batch-http": "^1.0.1",
"apollo-link-retry": "^1.0.1",
"apollo-link-dedup": "^1.0.2",
"apollo-link-ws": "^1.0.1",
"apollo-utilities": "^1.0.2",
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Cancel / Unsubscribe GraphQL Subscription
Problem Statement. We use GraphQL subscriptions for the real-time metrics data and show some graphs. When a user clicks on any graph panel, ......
Read more >how to unsubscribe with useQuery and subscribeToMore
Any associated subscriptions should be unsubscribed for you when the component unmounts. You shouldn't have to manually manage it unless you ...
Read more >Unsubscribe Settings - Salesforce Help
Enterprise 2.0 admins can manage how their accounts handle business-level unsubscribes in Email Studio. Choose one of the two options under the Properties....
Read more >mqtt-v5.0.html - MQTT Version 5.0 - OASIS Open
An error that is detected after the packet has been parsed and found to contain data that is not allowed by the protocol...
Read more >Subscription not working with Apollo Client 2 - Questions
subscribeToMore shows the following error in the console: [Exception: TypeError: 'caller' ... Apollo Client 2.0 is set up like this:
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
Has there been any updates to this issue? We are seeing exactly the same problem in our codebase when introducing apollo-link-state to our link chain. If there is any know workaround, then please share it. Reverting apollo-link-dedup to 1.0.0 did not solve it for us.
Since this is an
apollo-link-dedup
issue, and is being tracked in https://github.com/apollographql/apollo-link/issues/259, I’ll close it here. Thanks!