Skip to content

Apollo Client から TanStack Query への移行経緯とパフォーマンス改善理由をドキュメント化 - #6419

Merged
TinyKitten merged 2 commits into
devfrom
claude/apollo-react-query-cache-3zvji7
Jul 15, 2026
Merged

TinyKitten merged 2 commits into
devfrom
claude/apollo-react-query-cache-3zvji7

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

概要

Apollo Client から TanStack Query (React Query) + graphql-request への移行 (#6210) について、「キャッシュ戦略をどう扱ったか」「なぜ体感で大きく高速化したのか」を後から追えるよう開発者向けドキュメントとして残す。

変更の種類

  • バグ修正
  • 新機能
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • docs/apollo-to-react-query-migration.md を新規追加。移行前後のキャッシュ構成(Apollo の typePolicies / keyFields: false と現行 QueryClient の staleTime: Infinity)、keyFields: false を移植しなかった理由、強制再取得箇所、互換フックを整理。
  • 体感高速化の技術的要因を記載: TrainLCD のレスポンスが深いネストの巨大オブジェクトグラフであり、Apollo の正規化・freeze・broadcastQueries が単一 JS スレッド上でグラフを毎回走査していたこと、React Query 移行でその走査コストが消えたこと。
  • docs/README.md のドキュメント一覧に新規ドキュメントへのリンクを追加。

テスト

  • npm run lint が通ること
  • npm test が通ること
  • npm run typecheck が通ること

関連Issue

スクリーンショット(任意)

Summary by CodeRabbit

  • ドキュメント
    • Apollo Client から TanStack Query + graphql-request への移行内容を記録した資料を追加しました。
    • キャッシュ方針の違い、再取得の考え方、パフォーマンス改善の背景を整理しました。
    • 「ドキュメント一覧」から移行メモへアクセスできるようになりました。

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 74ec8a28-a19a-47b8-85b2-ba5e3618bdd7

📥 Commits

Reviewing files that changed from the base of the PR and between ab888ab and f2b8122.

📒 Files selected for processing (1)
  • docs/apollo-to-react-query-migration.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/apollo-to-react-query-migration.md

📝 Walkthrough

Walkthrough

Apollo ClientからTanStack Queryへの移行方針を記録したドキュメントを追加し、キャッシュ戦略、再取得方法、互換API、性能差の要因を説明しています。READMEから新規ドキュメントへリンクしています。

Changes

GraphQL移行ドキュメント

Layer / File(s) Summary
キャッシュ戦略の比較
docs/apollo-to-react-query-migration.md, docs/README.md
ApolloとTanStack Queryのキャッシュ単位、正規化、既定動作の違いを整理し、READMEに移行メモへのリンクを追加しています。
再取得と互換APIの記録
docs/apollo-to-react-query-migration.md
removeQueriesやrefetchによる再取得方法と、互換フック・クライアントAPIの挙動を記載しています。
性能差の要因と結論
docs/apollo-to-react-query-migration.md
Apolloのキャッシュ走査・差分検知・再構築と、移行後の参照保存中心の処理を比較し、体感速度の差を説明しています。

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

ぴょんと跳ねればキャッシュも軽く
深いグラフを月へと運ぶ
Apolloの森をあとにして
Queryの巣箱へデータを保存
うさぎも読み込み快適ぴょん

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 主要な変更である移行経緯と性能改善理由のドキュメント化を端的に示しています。
Description check ✅ Passed 概要、変更の種類、変更内容、テストが揃っており、テンプレート要件を概ね満たしています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/apollo-react-query-cache-3zvji7

Comment @coderabbitai help to get the list of available commands.

@TinyKitten TinyKitten self-assigned this Jul 15, 2026

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/apollo-to-react-query-migration.md`:
- Around line 187-188: Remove the trailing </content> and </invoke> tags from
the end of the migration document, leaving the Markdown content intact and
avoiding unauthorized inline HTML.
- Around line 143-149: Update the TanStack Query performance comparison in the
documented sections around the cache-write and read-cost claims to acknowledge
default structuralSharing: JSON-compatible results still undergo recursive
comparison and reference reuse. Separate the removal of Apollo normalization,
freezing, and broadcast costs from the remaining TanStack Query comparison
overhead, and avoid absolute claims such as O(1), reference-only storage, or
elimination of graph traversal.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a8e3d2f8-1d2d-453e-a66a-37caeadfb3ef

📥 Commits

Reviewing files that changed from the base of the PR and between f9cec41 and ab888ab.

📒 Files selected for processing (2)
  • docs/README.md
  • docs/apollo-to-react-query-migration.md

Comment thread docs/apollo-to-react-query-migration.md Resolved
Comment thread docs/apollo-to-react-query-migration.md Resolved
@TinyKitten

Copy link
Copy Markdown
Member Author

Fixes Applied Successfully

Fixed 1 file(s) based on 2 CodeRabbit feedback item(s).

Files modified:

  • docs/apollo-to-react-query-migration.md

Commit: f2b81220f

The latest autofix changes are on the claude/apollo-react-query-cache-3zvji7 branch.

@TinyKitten
TinyKitten merged commit 84b8203 into dev Jul 15, 2026
3 checks passed
@TinyKitten
TinyKitten deleted the claude/apollo-react-query-cache-3zvji7 branch July 15, 2026 12:10
@TinyKitten TinyKitten mentioned this pull request Jul 16, 2026
6 of 9 tasks
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.

2 participants