Bug: Dependent Query doesn't work with solid-js SSR
Mantenedores costumam responder em até 1 dia
@ardeora já está trabalhando nisso.
Desde 4/6/2024.
Avaliação
Esta issue ainda não foi avaliada.
Descrição
Describe the bug
In the Tanstack documentation there is a section about dependent queries: https://tanstack.com/query/latest/docs/framework/react/guides/dependent-queries
The example suggest that you should use enable to create dependent queries. The problem when using enable is that when it is disabled it doesn't suspend the current context and therefore doesn't fetch on the server.
Your minimal, reproducible example
https://codesandbox.io/p/github/BierDav/temp-tanstack-query-ssr-bug/master?import=true
Steps to reproduce
- Open codesandbox
- Run ´pnpm dev`
- Open the preview
- Now the server waits for 2 seconds before responding because of the
timoutquery insrc/routs/index.tsx, but the moment it finishes it doesn't care about the second query getting enabed and returning it immediately to the browser. - This causes that the client has to fetch the remaining
statequery. You can see that in the dev tools:
Expected behavior
The expected behavior would be that both queries are beeing evaluated before the server sends its initial response. But I don't know if this is even possible with this syntax from a technical perspective.
How often does this bug happen?
Every time
Screenshots or Videos
import { createQuery } from "@tanstack/solid-query";
export default function () {
const timeout = createQuery(() => ({
queryKey: ["timeout"],
queryFn: () =>
new Promise((resolve) => setTimeout(() => resolve("test"), 2000)),
}));
const state = createQuery(() => ({
queryKey: ["realQuery"],
queryFn: async () => {
const resp = await fetch("https://api.sampleapis.com/switch/games");
console.log("fetched");
return await resp.json();
},
enabled: !!timeout.data,
}));
return <>{JSON.stringify(state.data?.[0])}</>;
}
Platform
- Windows
- Node v21.7.3
- Chrome
Tanstack Query adapter
solid-query
TanStack Query version
v5.40.0
TypeScript version
No response
Additional context
No response
- Linguagem predominante
- TypeScript
- Estrelas
- 50.5k
- Forks
- 4.2k
- Merge médio
- 7h 46min
- PRs com merge (30d)
- 622
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de TanStack/query
-
solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)Talvez livre de novo @LeonxLJX assumiu há 55 dias e não há nenhum pull request aberto. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
TanStack/query#11358 · 2 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
refetchQueries with throwOnError leaves paused fetch rejection unhandled on client.clear()Talvez já em andamento @lazerg assumiu hoje. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 67/100
Mantenedores costumam responder em até 1 dia
-
useBaseQuery fetches the old query key when an <Activity> tree is revealedTalvez já em andamento @lazerg assumiu há 8 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
Mantenedores costumam responder em até 1 dia
-
[query-broadcast-client-experimental] broadcastQueryClient: an `added` event overwrites a receiving query that has no data (e.g. in error) with the sender's empty stateTalvez já em andamento @lazerg assumiu há 8 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 25/100
Mantenedores costumam responder em até 1 dia
-
solid-query 6.0.0-rc.5: onCacheEvent throws NotReadyError during a Solid 2 (rc.14+) transition landingTalvez já em andamento @UzumakiODZ assumiu há 14 dias. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 28/100
TanStack/query#12031 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de TanStack/query
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
gnosis/gnosis_vpn#661 ·
Mantenedores costumam responder em até 1 dia
-
content-freshness: staleOwnedContent doc comments still say 'complete receipt' (follow-up to #7912)Abertatriage:bug-verified
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
Mantenedores costumam responder em até 1 dia
-
fix: reject sourceStorage/packagedStorage bucket that differs from the stack default (fail loud)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Eyevinn/open-videocore#1300 ·
Mantenedores costumam responder em até 1 dia
-
nextjs-tracking
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
cloudflare/vinext#4390 ·
Mantenedores costumam responder em até 1 dia
-
kind/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
kubernetes-sigs/headlamp#8175 ·
Mantenedores costumam responder em até 2 dias