gqty icon indicating copy to clipboard operation
gqty copied to clipboard

fetchOptions of queryFetcher is undefined

Open mmmoli opened this issue 1 year ago • 1 comments

Hi, really excited by gqtv.

I'm using the JS client in a Next.js app. The fetchOptions are always undefined.

Here's my resolved call:

return await resolved(() => query.projects(), {
    fetchOptions: {
        headers: {
            'Content-Type': 'application/json',
             authorization: 'secret_token',
        },
        signal: controller.signal,
   },
});

And the stock queryFetcher:

const queryFetcher: QueryFetcher = async function (
  query,
  variables,
  fetchOptions
) {
  debugger; // fetchOptions is always undefined
  …
}

I'd expect to see authorization: 'secret_token',.

Deps:

  • "@gqty/logger": "3.0.0-alpha-c5b89dbd.0",
  • "@gqty/react": "2.2.0-alpha-445c0456.0",
  • "@gqty/subscriptions": "3.0.0-alpha-c5b89dbd.0",
  • "gqty": "2.4.0-alpha-c5b89dbd.0",

DevDeps:

  • "@gqty/cli": "3.3.1-alpha-c5b89dbd.0",

Tried previous versions too.

Anything you'd like me to investigate?

mmmoli avatar Dec 05 '22 15:12 mmmoli

Using a fresh install with the exact alpha versions, I can see my supplied fetchOptions from a simple console.log().

Would you mind sharing a minimum repo? No need to share your schema, your generated client in a Codesandbox should do.

vicary avatar Dec 05 '22 18:12 vicary

@mmmoli Please feel free to reopen when you are ready to share more context!

vicary avatar Apr 22 '24 21:04 vicary