-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
useSuspenseQuery with skipToken still issues network request #11768
Comments
Using This is highly curious. Could you provide us with a reproduction showing that happening? |
I have figured out that the problem has to do with The repro seems to be as simple as: const client = new ApolloClient({
uri: "/graphql",
connectToDevTools: true,
cache: new InMemoryCache(),
});
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<ApolloProvider client={client}>
<DummyComponent />
</ApolloProvider>
</React.StrictMode>,
);
export const DummyComponent: React.FunctionComponent<
PropsWithChildren<unknown>
> = ({children}) => {
console.log("!!! DummyComponent render");
let data: GetSpecQuery;
const {data: res} = useQuery(GET_BINARIES, skipToken);
console.log("!!! DummyComponent. data: ", res);
return <>DummyComponent</>;
}; FWIW, Please tell me if this doesn't repro and I'll work on packaging it somehow. |
@andreimatei out of curiosity, is this reproducible using version 3.9.9? Also in the code snippet above, I'm assuming you meant |
No, it does not seem to reproduce on 3.9.9! So the issue seems to have been introduced in 3.9.10. Going back and forth between these two versions reliably introduces and removes the problem.
Sorry, the snippet was supposed to use export const DummyComponent: React.FunctionComponent<
PropsWithChildren<unknown>
> = ({children}) => {
console.log("!!! DummyComponent render");
let data: GetSpecQuery;
const {data: res} = useSuspenseQuery(GET_BINARIES, skipToken);
console.log("!!! DummyComponent. data: ", res);
return <>DummyComponent</>;
};
|
Thanks for confirming that, @andreimatei! I believe @jerelmiller has some thoughts here on how to reconcile the fix we shipped in 3.9.10 with the issue you're seeing. We're also working on releasing 3.10 this week, so I can't give a precise timeline on the fix here, but we're looking into it. Thanks! |
167 |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue Description
I'm unconditionally using
skipToken
and yet thisuseSuspenseQuery
call produces a network request for the respective query.Am I misunderstanding that
skipToken
is supposed to not generate a request? Or what could be the matter?Link to Reproduction
N/A
Reproduction Steps
No response
@apollo/client
version3.9.10
The text was updated successfully, but these errors were encountered: