Svelte createQuery doesn't support passing in a persister properly
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- frontend
调研方向
首先检查 Svelte createQuery 选项的类型以及它们如何将选项传递给 QueryClient,然后比较每个查询的 persister 处理与 defaultOptions。完成的标准是:向 createQuery 提供的 persister 能够在没有类型错误的情况下被接受,并覆盖客户端默认值,同时为该行为提供回归测试覆盖。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
It is possible to add a persister (I'm using the experimental_createQueryPersister) to the QueryClient via defaultOptions as follows:
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 60000
persister: persister.persisterFn,
},
},
});
Previously it also used to be possible to set the persister when using createQuery for example:
const query = createQuery(() => ({
queryKey: ['todos'],
queryFn: () => fetchTodos(),
persister: persister.persisterFn
}))
This would then override the default persister defined in the QueryClient, however, this now throws type errors.
Is this a known issue or am I doing something wrong?
Sometimes it's quite useful to be able to override the default persister, for example, if I want to pass in a "buster" to forcibly invalidate the cache.
Thanks!
Your minimal, reproducible example
na
Steps to reproduce
na
Expected behavior
na
How often does this bug happen?
None
Screenshots or Videos
na
Platform
na
Tanstack Query adapter
None
TanStack Query version
"@tanstack/query-core": "^5.90.2", "@tanstack/query-persist-client-core": "^5.90.2", "@tanstack/svelte-query": "^6.0.0",
TypeScript version
No response
Additional context
No response
- 主要语言
- TypeScript
- 星标
- 50.3k
- 派生
- 4.2k
- 平均合并
- 23 小时 7 分钟
- 30 天内合并 PR
- 231
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/query 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
TanStack/query#11358 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
TanStack/query#11106 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 58/100
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 74/100
TanStack/query#11639 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
diegosouzapw/OmniRoute#14869 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 94/100
维护者通常 1 天内回复
-
status: waiting triage
难度 2/5 1-3 小时 新手友好度 84/100
freeCodeCamp/freeCodeCamp#70412 ·
维护者通常 1 天内回复
-
Mend: dependency security vulnerability untriaged
难度 1/5 1 小时以内 新手友好度 88/100
opensearch-project/OpenSearch-Dashboards#12816 ·
维护者通常 1 天内回复