Skip to content

feat: migrate useExchangeRate to TanStack Query #46

Closed

Description

@Gaubee

背景

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

当前问题

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

  • 手动管理缓存 Map
  • 多组件重复请求
  • 缓存逻辑复杂

改造目标

创建 useExchangeRateQuery hook:

  • staleTime: 5min(替代手动缓存)
  • 支持 baseCurrency + targetCurrencies 查询
  • 自动请求去重

涉及文件

  • src/hooks/use-exchange-rate.ts
  • 使用汇率的组件

关联

Part of TanStack Query migration series (PR #43)

Activity

  1. added 2 commits that reference this issue on Dec 22, 2025
    8fa5ab4
    d4b171b
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