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

fix: make skip work when execute overrides variables #213

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mzgajner
Copy link

I noticed the following issue - when skip callback uses variables being passed in, only the default variables that were passed in when useQuery was called are checked.

const { data, execute } = useQuery({
  query: MyQueryDocument,
  fetchOnMount: false,
  variables: () => { id: 'invalid-id' }
  skip: ({ id }) => id === 'invalid-id' 
})

If I try to override variables when using execute...

execute({
  variables: { 
    id: "completely-valid-id" 
  }
})`

...the query is still skipped even though the variables passed to execute are OK.

Copy link

codecov bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.32%. Comparing base (f2b6c7b) to head (19ca662).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #213   +/-   ##
=======================================
  Coverage   47.32%   47.32%           
=======================================
  Files          49       49           
  Lines        3250     3250           
  Branches      308      307    -1     
=======================================
  Hits         1538     1538           
  Misses       1712     1712           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

1 participant