Describe the bug
Invoking useQuery or useMutation with a regular function call (instead of a tagged template literal) + Provider triggers invariant variation:
useQuery requires a URL to be set as the 1st argument,
unless you wrap your app like:
<Provider url="https://q0hkn.csb.app"><App /></Provider>
Describe the bug Invoking
useQuery
oruseMutation
with a regular function call (instead of a tagged template literal) + Provider triggers invariant variation:⚠️ Make a Codesandbox ⚠️ I took the GraphQL Codesandbox and just added parenthesis around the
useQuery
call: https://codesandbox.io/s/graphql-usequery-provider-forked-q0hkn?file=/src/index.js:369-434To Reproduce Steps to reproduce the behavior:
Expected behavior I would expect this invariant not to trigger because
useQuery
is wrapped in a<Provider url="...">
.This triggers because of this invariant: https://github.com/ava/use-http/blob/d725956cb2fab9b2a7c979669559ab0426a361c4/src/useQuery.ts#L25-L28 (also present on
useMutation
)!!context.url
is true, butArray.isArray(urlOrQuery)
is false, sotrue && false => false
which triggers the invariant.