Skip to content

feat: add usePriceQuery hook with TanStack Query - #51

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

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

Conversation

@Gaubee

@Gaubee Gaubee commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Closes #45

改动

创建 usePriceQuery hook:

  • 5min staleTime:替代手动 5min 缓存逻辑
  • 60s 轮询:自动刷新价格
  • 共享缓存:多个组件使用同一 symbols 时共享数据
  • 请求去重

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

使用示例

// 之前
const { prices } = usePriceService(['ETH', 'BTC'])

// 现在
const { prices } = usePriceQuery(['ETH', 'BTC'])

- Create usePriceQuery hook with:
  - 5min staleTime: replaces manual cache logic
  - 60s polling: automatic price refresh
  - Shared cache across components
  - Request deduplication
- Keep existing usePriceService for backward compatibility

Closes #45
@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/price-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 usePriceService to TanStack Query

1 participant