-
-
Notifications
You must be signed in to change notification settings - Fork 523
useQuery onResult callback not being called on second query attempt in V4.0.0-Beta.2-4 #1472
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
Comments
After looking at the changes that came into beta.2 I think the changes in either #1388 or ones related to #1432 may be what is causing this to fail. @Akryum @ishitatsuyuki What is the expected behaviour for the |
You are calling |
Awesome! I see what you mean using it outside of script setup. I'm using vue-apollo inside of a pinia store in the main app I'm debugging. Is there a better way to use Vue-Apollo composition inside a store without having to provide the client in every single store? |
Describe the bug
Starting in V4.0.0-Beta.2, when using the
onResult
callback to receive data fromuseQuery
function, you only receive data fromonResult
on the first call.The 2nd call, and so on, never return data with the
onResult
callback.V4.0.0-Beta.1 does call the hook every time
useQuery
is called.To Reproduce
I've created a reproduction you can run on StackBlitz.
To see what I'm describing, click on the
Catch Pikachu
button and watch the data flow into the page.Then click the button again.
You will see the page clear and the data never load back in while the loading text stays on screen indefinitely because
onResult
never sets it to false.You'll also see where the console only has one
onResult
log no matter how many times you click.Expected behavior
I expect that
onResult
will be called with response data every timeuseQuery
is called.Versions
vue: 3.3.2
vue-apollo: 4.0.0-Beta.2 - 4
@apollo/client: 3.7.14
Additional context
Unrelated question, why is it in my StackBlitz example that I have to call
ProvideApolloClient
in thefetchPikachuData
function foruseQuery
to see the default client?The text was updated successfully, but these errors were encountered: