Skip to content

feat: migrate usePriceService to TanStack Query #45

Closed

Description

@Gaubee

背景

基于 PR #43 引入的 TanStack Query 架构,继续改造数据获取接口。

当前问题

src/hooks/use-price-service.ts 手动实现 5 分钟缓存:

  • 手动管理缓存逻辑
  • 多组件无法共享请求(去重)
  • 缓存 TTL 硬编码

改造目标

创建 usePriceQuery hook:

  • staleTime: 5min(替代手动缓存)
  • 支持批量 symbol 查询
  • 自动请求去重
  • refetchInterval: 60s(价格轮询)

涉及文件

  • src/hooks/use-price-service.ts
  • 使用价格的组件

关联

Part of TanStack Query migration series (PR #43)

Activity

  1. added 2 commits that reference this issue on Dec 22, 2025
    a56788d
    d4b171b
  2. added a commit that references this issue on Dec 22, 2025
    c99548e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions