Skip to content

refetch in useQuery will auto merge the previous variable with current variable #1561

Closed
@Zhuyi731

Description

@Zhuyi731

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

const testGql = gql`
  query lossList($query: String){
  }   
`
const { refetch } = useQuery(testGql, params, options)
refetch({ query:"first time" })    // the first time with variable  query: first time
refetch({})    //  the second time, I don't want to pass any variable to backend, but it will still merge the privious variable into the current varible

** Reason **
it is caused by the code this line. I think this is a bug, sometimes the server do need a empty request variable.
image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions