Skip to content
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

skip() doesn't skip query #1522

Open
jarkt opened this issue Nov 27, 2023 · 1 comment
Open

skip() doesn't skip query #1522

jarkt opened this issue Nov 27, 2023 · 1 comment

Comments

@jarkt
Copy link

jarkt commented Nov 27, 2023

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

@aubcel
Copy link

aubcel commented Jan 5, 2024

I have a similar problem.
If the return value of skip changes from false to true it does not seem to be recognized and the query gets fired with the false value and results in an error.
So initially the query was not skipped and now it should get skipped.

Edit: This seems to be a problem from the core package actually: apollographql/apollo-client#6190

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants