@tanstack/svelte-query

中文文档
6.3.8发布于 2026/11/02MITTypeScriptES Module构建来源已验证

Primitives for managing, caching and syncing asynchronous and remote data in Svelte

原始使用文档
文档目录3 节
  1. Visit tanstack.com/query for docs, guides, API and more!
  2. Quick Features
  3. Become a Sponsor!
TanStack Svelte Query

Functions for fetching, caching and updating asynchronous data in Svelte

#TanStack Release status semantic-release Join the discussion on Github Best of JS Gitpod Ready-to-Code

Enjoy this library? Try the entire TanStack! TanStack Table, TanStack Router, TanStack Virtual

Visit tanstack.com/query for docs, guides, API and more!

Quick Features

  • Transport/protocol/backend agnostic data fetching (REST, GraphQL, promises, whatever!)
  • Auto Caching + Refetching (stale-while-revalidate, Window Refocus, Polling/Realtime)
  • Parallel + Dependent Queries
  • Mutations + Reactive Query Refetching
  • Multi-layer Cache + Automatic Garbage Collection
  • Paginated + Cursor-based Queries
  • Load-More + Infinite Scroll Queries w/ Scroll Recovery
  • Request Cancellation
  • Dedicated Devtools

Become a Sponsor!

版本与发布记录

@tanstack/svelte-query 共发布 438 个版本,首次发布于 2023/01/08;过去 12 个月发布了 78 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
6.3.8latest2026/11/02今天
6.3.72026/11/012 天前
6.3.62026/10/268 天前
6.3.52026/10/2014 天前
6.3.42026/10/1816 天前
6.3.32026/10/1519 天前

其他发布通道:alpha → 5.0.0-alpha.91,beta → 5.0.0-beta.35,rc → 5.0.0-rc.16,previous → 4.44.0。

关于 @tanstack/svelte-query 的常见问题

@tanstack/svelte-query 是什么?

Svelte中用于管理、缓存和同步异步和远程数据的原语

如何安装 @tanstack/svelte-query?

在项目目录运行 npm install @tanstack/svelte-query,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:svelte(^5.25.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@tanstack/svelte-query 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@tanstack/svelte-query 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@tanstack/svelte-query 可以商用吗?

@tanstack/svelte-query 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@tanstack/svelte-query 还在维护吗?

最新版本 6.3.8 发布于 2026/11/02(今天);至今共发布 438 个版本,其中过去 12 个月发布了 78 个;首次发布于 2023/01/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。