TanStackT
TanStackโ€ข8mo agoโ€ข
7 replies
uncertain-scarlet

Quick question about key equality and using it with gql

This might be obvious based on the docs:
As long as the query key is serializable using JSON.stringify
Does this mean they are checked via the JSON serialised version for equality?

So if I did:

  const { data, refetch } = useSuspenseQuery({
    queryKey: [CharactersDocument, { name }] as const,
    queryFn: ({ queryKey: [, { name }] }) => {
      console.log("๐Ÿ”„ Query function called for characters", { name });
      return graffle.gql(CharactersDocument).send({ name });
    },
  });


This would be perfectly acceptable and work as expected?
Was this page helpful?