1

I use a simple useQuery:

const {data, loading, error} = useQuery<ListingsData, ListingsVariables>(LISTINGS, {
    variables: {
        page: page,
        limit: LISTINGS_LIMIT,
        sort: sort
    }
});

But I noticed that /api is called twice.

enter image description here

I tried to disable React.Strict and tried to use fetchPolicy, but it didn't help.

Is there any way to skip the first fetch??? Or is it OK and I don't need to worry about this at all???

Mintis
  • 51
  • 2

1 Answers1

0

For anyone coming here in the future: the first is an OPTIONS call to the /graphql endpoint, the second is a fetch. Inspect the headers & response of the first call and you'll see that.

elhil
  • 101
  • 1
  • 5