I am currently trying to update a GraphQL subscription using the useSubscription hook from apollo v3 in a useEffect hook:
let containerSubscription = useSubscription<CreatedDateSubscription, CreatedDateSubscriptionVariables>(
gql(containerUpdatedOnCreatedDate),
{
variables: { createdDate: selectedDate },
shouldResubscribe: true, // is this needed?
},
);
// update subscription on date change
React.useEffect(() => {
// how do I update the subscription here?
// setting containerSubscription.variables = ... does not change the subscription
}, [selectedDate]);
I could not find any solution in the apollo docs on how to address this problem.
Any help would be appreciated!