Bug: Dependent Query doesn't work with solid-js SSR
維護者通常 1 天內回覆
@ardeora 已經在處理了。
開始於 2024年6月4日。
評估
這個 Issue 還沒有評估資料。
描述
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
- 主要語言
- TypeScript
- 星號
- 50.5k
- 分支
- 4.2k
- 平均合併
- 10 小時 23 分鐘
- 30 天內合併 PR
- 581
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TanStack/query 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
solid-query: STRICT_READ_UNTRACKED on Solid 2 — client()/options() read in component body (useMutation, useBaseQuery)可能重新可做 @LeonxLJX 於 59 天前認領,目前沒有進行中的 PR。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
TanStack/query#11358 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
[svelte-query] A result key first read after the query settled stays stale: the component's copy refreshes only on a change of an already-tracked key可能已有人在做 @lazerg 今天認領。 未關閉
難度 3/5 1-2 天 新手友好度 20/100
維護者通常 1 天內回覆
-
[query-core] [performances] `setQueryData` dispatches a `success` event (and triggers broadcast/persist) even when the new data is structurally identical to the cached data可能重新可做 關聯的 PR 已關閉且未合併。 未關閉
難度 4/5 3-5 天 新手友好度 52/100
維護者通常 1 天內回覆
-
[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 state可能已有人在做 @lazerg 於 12 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 25/100
維護者通常 1 天內回覆
相似的 Issue
-
triage
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
🎙️ task - drop the raw `./node_modules/.bin/rhachet roles boot` line from bhuild's feedback template未關閉
難度 2/5 1-3 小時 新手友好度 62/100
ehmpathy/rhachet-roles-bhuild#639 ·
維護者通常 1 天內回覆
-
e2e-failure ready-to-code
難度 2/5 1-3 小時 新手友好度 70/100
redhat-developer/rhdh-plugin-export-overlays#4650 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
維護者通常 13 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
omdsh-dev/DSH-better-sidebar#1098 ·
維護者通常 2 天內回覆