Closed Zhuyi731 closed 1 month ago
I think this is a feature rather than a bug, I've recently encountered this too. It's a bit hidden but the docs state the following:
If you provide new values for some of your original query's variables but not all of them, refetch uses each omitted variable's original value.
What fixed it for me was explicitly setting the property value to null
.
@tristandubbeld that is correct, we should probably try to be more explicit in the docs about it.
Describe the bug refetch in useQuery will auto merge the previous variable with current variable
To Reproduce Steps to reproduce the behavior:
see the code below
Reason it is caused by the code this line. I think this is a bug, sometimes the server do need a empty request variable.
Expected behavior the second time's request should request with no varibale
Versions vue: 3.4.21 vue-apollo: 4.0.2 @apollo/client: 3.9.9