Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Svelte createQuery doesn't support passing in a persister properly

未关闭
#9,729 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
typescript
领域
frontend

调研方向

首先检查 Svelte createQuery 选项的类型以及它们如何将选项传递给 QueryClient,然后比较每个查询的 persister 处理与 defaultOptions。完成的标准是:向 createQuery 提供的 persister 能够在没有类型错误的情况下被接受,并覆盖客户端默认值,同时为该行为提供回归测试覆盖。

由索引模型根据 Issue 内容生成。

描述

package: svelte-query
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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/query 的其他 Issue

查看 TanStack/query 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。