vuejs / apollo

🚀 Apollo/GraphQL integration for VueJS

Home Page:http://apollo.vuejs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

skip() doesn't skip query

jarkt opened this issue · comments

Describe the bug
I've created a component with the following reactive query:

  apollo: {
    profileByAccountId: {
      query: gql`
        query ProfileByAccountId($accountId: UUID!) {
            profileByAccountId(accountId: $accountId) {
                id
                pseudonym
            }
        }
      `,
      variables() {
        const variables = {
          accountId: this.sessionStore.payload?.account_id || 'WRONG ID...'
        }
        console.log('variables()', variables)

        return variables
      },
      skip() {
        const skip = typeof this.sessionStore.payload?.account_id === "undefined"
        console.log('skip()', skip)

        return skip
      }
    }
  }

The problem is, that the query is executed even if skip delivers true. In this case the accountId is "WRONG ID...". But the query is canceled before it completes. Firefox shows "NS_BINDING_ABORTED" for the query in the network tab.

Expected behavior
No request has to be executed.

Versions
vue: 3.3.4
@vue/apollo-composable: ^4.0.0-beta.11
@vue/apollo-option: ^4.0.0-beta.9
@vue/apollo-ssr: ^4.0.0-beta.9
@vue/apollo-util: ^4.0.0-beta.6
@apollo/client: ^3.8.5