You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Intended outcome:
Trying to set new link after apollo client initialisation by using the public method setLink. With this method, any new link
should be invoked only once.
Actual outcome:
By using the above method, can see new apollo-link is being called every time setLink is called/set.
How to reproduce the issue:
Here is the code to reproduce it.
Test component
import*asReactfrom"react";importgqlfrom"graphql-tag";import{ApolloLink,useApolloClient}from"@apollo/client";exportconstTest=()=>{constOtherLink=newApolloLink((operation,forward)=>{console.log("custom link is called");returnforward(operation);});constclient=useApolloClient();/* by calling it twice, we will observe that "custom link is called" is called twice. Ideally it should be called only once */client.setLink(ApolloLink.from([OtherLink,client.link]));client.setLink(ApolloLink.from([OtherLink,client.link]));client.query({query: gql` { widgets } `}).then((data)=>{//console.log(data);});return<>Test</>;};
Intended outcome:
Trying to set new link after apollo client initialisation by using the public method setLink. With this method, any new link
should be invoked only once.
Actual outcome:
By using the above method, can see new apollo-link is being called every time setLink is called/set.
How to reproduce the issue:
Here is the code to reproduce it.
Test component
Parent component
Codesandbox
https://codesandbox.io/s/wizardly-tu-94i5f?file=/src/App.js
Versions
The text was updated successfully, but these errors were encountered: