TanStackT
TanStack3y ago
2 replies
popular-magenta

Query.data being a function

i'm using solid start and solid query v4, and with the following code:
    const channels = createQuery({
        queryKey: () => ["servers", params.serverId, "channels"],
        queryFn: (c) => fetch(`${import.meta.env.VITE_API_URL}/${API_VERSION}/${c.queryKey.join('/')}`).then((r) => r.json()),
        initialData: [],
        suspense: true,
    })
for a very short time channels.data becomes a function, and even typescript doesn't know about that, so is it intended behaviour or is it a bug?
Was this page helpful?