Skip to content

feat: add useExchangeRateQuery hook with TanStack Query - #52

Closed
Gaubee wants to merge 1 commit into
mainfrom
feat/exchange-rate-query
Closed

Gaubee wants to merge 1 commit into
mainfrom
feat/exchange-rate-query

Conversation

@Gaubee

@Gaubee Gaubee commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Closes #46

改动

创建 useExchangeRateQuery hook:

  • 5min staleTime:替代手动 5min 缓存逻辑
  • 共享缓存:多个组件使用同一 base+targets 时共享数据
  • 请求去重

保留原有 useExchangeRate 以保持向后兼容。

使用示例

// 之前
const { data } = useExchangeRate('USD', ['CNY', 'EUR'])

// 现在
const { data } = useExchangeRateQuery('USD', ['CNY', 'EUR'])

- Create useExchangeRateQuery hook with:
  - 5min staleTime: replaces manual cache logic
  - Shared cache across components
  - Request deduplication
- Keep existing useExchangeRate for backward compatibility

Closes #46
@Gaubee

Gaubee commented Dec 22, 2025

Copy link
Copy Markdown
Contributor Author

Superseded by #53

@Gaubee Gaubee closed this Dec 22, 2025
@Gaubee
Gaubee deleted the feat/exchange-rate-query branch January 4, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: migrate useExchangeRate to TanStack Query

1 participant