WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@yokomaru
Copy link
Contributor

@yokomaru yokomaru commented Dec 3, 2025

Issue

概要

  • fetchAPIでGETリクエストを実行しそのレスポンスをJSONで返す処理を自前のfetcher.jsではなくrails/request.jsに置き換える
    • コンポーネント・ファイルでのインポートと呼び出しをrequest.jsのgetに置換
    • fetcher.jsファイル自体を削除

影響ファイル

  • React(JSX)
    • Bookmarks.jsx
    • BookmarksInDashboard.jsx
    • Notifications.jsx
    • Products.jsx
    • RegularEvents.jsx
    • Reports.jsx
    • NotificationsBell.jsx
    • TagsInput.jsx
    • Events.jsx
  • JS
    • tag.js

実装方針

  • 現在非React化対応が行われているため今回修正対応のReactファイルはほぼ削除される想定だが、fetcher.jsの削除を優先する
  • ファイルの依存を減らすため、共通処理をカプセル化する新しいラッパーファイルを作らずfetcher.jsを使用している既存の13箇所に直接ロジックを記述する
  • rails/request.jsjsonをgetterとして定義している(参考)ため、.then(res => res.json) のような記述となっている(関数参照をしているわけではない)

変更確認方法

  1. chore/replace_fetcher_js_with_request_jsをローカルに取り込む
  2. 以下ページにてデータが問題なく取得できていることを確認する

どのユーザーでもOK

管理者権限で確認

Screenshot

見た目の変更はありません。

Summary by CodeRabbit

  • リファクタリング
    • 内部のデータ取得処理を統一し、フレームワーク標準のリクエスト機能に置き換えました。
    • 表示・動作や公開APIの署名に変更はなく、既存の読み込み・削除挙動は維持されています。

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 3, 2025

Walkthrough

複数のフロントエンドコンポーネントが共通の app/javascript/fetcher.js の利用をやめ、@rails/request.jsget を使うファイル内ローカルの fetcher 実装(get(url, { responseKind: 'json' }).then(res => res.json) 形式)へ置換され、app/javascript/fetcher.js のデフォルトエクスポートが削除された。

Changes

コホート / ファイル(s) 変更概要
コンポーネント群:fetcher を Rails request に置換
app/javascript/components/Bookmarks.jsx, app/javascript/components/BookmarksInDashboard.jsx, app/javascript/components/Events.jsx, app/javascript/components/Notifications.jsx, app/javascript/components/NotificationsBell/NotificationsBell.jsx, app/javascript/components/Products.jsx, app/javascript/components/RegularEvents.jsx, app/javascript/components/Reports.jsx, app/javascript/components/Tags/TagsInput.jsx
既存の ../fetcher デフォルトインポートを削除。@rails/request.js から get(必要箇所で destroy 継続)をインポートし、各ファイル内でローカル fetcher を定義して useSWR に渡すように変更(get(url, { responseKind: 'json' }).then(res => res.json) の形)。公開API/シグネチャの変更なし。
削除:共通フェッチャーユーティリティ
app/javascript/fetcher.js
デフォルトエクスポートの fetcher(url) を削除(従来の fetch(url).then(res => res.json()) 実装を除去)。
タグ関連ユーティリティ更新
app/javascript/tag.js
デフォルト fetcher のインポートを削除。{ get } を導入し await get(url, { responseKind: 'json' }) とその後の JSON 解析(response.json() 呼び出し)に置換。

Estimated code review effort

🎯 3 (中程度) | ⏱️ ~20 分

  • 注意点:
    • 多数のファイルで .then(res => res.json) と書かれている箇所が関数参照を返してしまい、正しくは res.json() として呼び出す必要があるか確認すること。
    • destroy を使う削除処理のオプションや戻り値が意図どおり維持されているか確認すること。
    • リポジトリ内で残りの app/javascript/fetcher.js 参照がないか全体検索すること。

Possibly related issues

  • fetcher.jsを撤廃したい #9257 — 本 PR は app/javascript/fetcher.js の削除と @rails/request.js への置換を行っており、このイシューの目的と直接一致。

Possibly related PRs

Suggested reviewers

  • komagata
  • thmz337
  • smallmonkeykey

🐰 古い fetcher にさよならを言うよ、
get が跳ねてデータを呼ぶよ、
destroy はそのまま踊り続け、
JSON は括弧で抱きしめてね、
新しい朝、コード畑でぴょん。

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed プルリクエストのタイトルは「fetcher.jsを廃止しrequest.jsに処理を統一」で、主な変更内容(自前のfetcher.jsを廃止してrails/request.jsに統一)を明確に要約している。
Description check ✅ Passed PR説明はテンプレート構造に従い、Issue番号、概要、影響ファイル、実装方針、変更確認方法を含む詳細な情報が記載されています。
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/replace_fetcher_js_with_request_js

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@yokomaru yokomaru self-assigned this Dec 3, 2025
@yokomaru yokomaru marked this pull request as ready for review December 10, 2025 07:13
@github-actions github-actions bot requested a review from komagata December 10, 2025 07:13
@yokomaru yokomaru force-pushed the chore/replace_fetcher_js_with_request_js branch from 0375a84 to 746c3bf Compare December 10, 2025 08:25
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/javascript/components/NotificationsBell/NotificationsBell.jsx (1)

8-8: fetcher の実装は正しいですが、クォートの統一を検討してください。

実装ロジックは正しく、Rails request.js の json getter を適切に使用しています(learnings に基づく)。ただし、このファイルでは "json" とダブルクォートを使用していますが、他のファイル(Bookmarks.jsx、Events.jsx、Notifications.jsx など)では 'json' とシングルクォートを使用しています。

Prettier が自動整形するため実害はありませんが、統一性の観点から他のファイルと揃えることをご検討ください。

必要に応じて以下の diff を適用できます:

-const fetcher = (url) => get(url, { responseKind: "json" }).then((res) => res.json)
+const fetcher = (url) => get(url, { responseKind: 'json' }).then((res) => res.json)
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0375a84 and 746c3bf.

📒 Files selected for processing (11)
  • app/javascript/components/Bookmarks.jsx (1 hunks)
  • app/javascript/components/BookmarksInDashboard.jsx (1 hunks)
  • app/javascript/components/Events.jsx (1 hunks)
  • app/javascript/components/Notifications.jsx (1 hunks)
  • app/javascript/components/NotificationsBell/NotificationsBell.jsx (1 hunks)
  • app/javascript/components/Products.jsx (1 hunks)
  • app/javascript/components/RegularEvents.jsx (1 hunks)
  • app/javascript/components/Reports.jsx (1 hunks)
  • app/javascript/components/Tags/TagsInput.jsx (1 hunks)
  • app/javascript/fetcher.js (0 hunks)
  • app/javascript/tag.js (2 hunks)
💤 Files with no reviewable changes (1)
  • app/javascript/fetcher.js
🚧 Files skipped from review as they are similar to previous changes (6)
  • app/javascript/components/Bookmarks.jsx
  • app/javascript/components/Tags/TagsInput.jsx
  • app/javascript/tag.js
  • app/javascript/components/Reports.jsx
  • app/javascript/components/Products.jsx
  • app/javascript/components/Events.jsx
🧰 Additional context used
📓 Path-based instructions (2)
app/**/*.{rb,js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Rails app code should be organized in app/ directory with subdirectories: models/, controllers/, views/, jobs/, helpers/, and frontend code under javascript/ (Shakapacker)

Files:

  • app/javascript/components/RegularEvents.jsx
  • app/javascript/components/NotificationsBell/NotificationsBell.jsx
  • app/javascript/components/BookmarksInDashboard.jsx
  • app/javascript/components/Notifications.jsx
app/javascript/**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

JavaScript/TypeScript code in app/javascript/ should be linted with ESLint and formatted with Prettier via yarn lint scripts; use React 17 and Shakapacker/Webpack 5

Files:

  • app/javascript/components/RegularEvents.jsx
  • app/javascript/components/NotificationsBell/NotificationsBell.jsx
  • app/javascript/components/BookmarksInDashboard.jsx
  • app/javascript/components/Notifications.jsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: tyrrell-IH
Repo: fjordllc/bootcamp PR: 9306
File: app/javascript/components/Bookmarks.jsx:248-265
Timestamp: 2025-11-17T00:46:30.794Z
Learning: fjordllc/bootcamp プロジェクトでは、Reactからバニラ JavaScript への移行作業が進行中である。そのため、新しいReactファイルの作成は避け、既存のReactコンポーネント内で完結する実装が推奨される。BookmarksInDashboard.jsx は issue #9045 で削除予定。
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9331
File: app/javascript/action_completed_button.js:46-53
Timestamp: 2025-12-04T01:50:46.369Z
Learning: Rails request.js の FetchResponse クラスでは、HTTP ステータスコードは `response.statusCode` プロパティでアクセスする必要がある。`response.status` ではなく `response.statusCode` を使用する。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 8877
File: app/javascript/check-stamp.js:22-24
Timestamp: 2025-07-04T07:15:17.639Z
Learning: Rails request.jsライブラリでは、FetchResponseクラスのjsonプロパティはgetterとして定義されており、response.json()ではなくresponse.jsonとして使用する必要がある。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 8877
File: app/javascript/watches.js:78-78
Timestamp: 2025-07-26T01:11:03.921Z
Learning: Rails request.jsのFetchResponseクラスでは、text、json、htmlプロパティはgetterとして定義されており、response.text()ではなくresponse.textとしてアクセスする必要がある。getterは自動的にレスポンスをキャッシュし、jsonの場合はContent-Typeの検証も行う。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-04T07:17:55.949Z
Learning: Rails request.jsのFetchResponseクラスでは、json、text、htmlなどはgetterとして定義されており、response.json()ではなくresponse.jsonとしてアクセスする必要がある。また、getterはContent-Typeの自動チェック機能を含んでいる。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 8877
File: app/javascript/check-stamp.js:22-24
Timestamp: 2025-07-04T07:15:17.639Z
Learning: Rails request.jsライブラリでは、FetchResponseクラスのjsonプロパティはgetterとして定義されており、response.json()ではなくresponse.jsonとして使用する必要がある。また、Content-Typeがapplication/jsonでない場合は自動的にエラーを投げる安全性チェックも含まれている。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/product.rb:59-61
Timestamp: 2025-09-11T14:47:53.256Z
Learning: Rails アップグレードPRでは、アップグレードに直接関連しない性能改善や機能追加の提案は避けるべき。PRのスコープを維持することが重要で、そのような改善提案は別PRで対応すべきである。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-04T07:17:55.949Z
Learning: Rails request.jsのFetchResponseクラスでは、jsonとtextはgetterとして定義されており、それぞれPromiseを返す。jsongetterは自動的にContent-Typeをチェックし、application/jsonでない場合はエラーを投げる。また、レスポンスは一度パースされるとキャッシュされる仕組みになっている。
📚 Learning: 2025-07-04T07:15:17.639Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 8877
File: app/javascript/check-stamp.js:22-24
Timestamp: 2025-07-04T07:15:17.639Z
Learning: Rails request.jsライブラリでは、FetchResponseクラスのjsonプロパティはgetterとして定義されており、response.json()ではなくresponse.jsonとして使用する必要がある。

Applied to files:

  • app/javascript/components/RegularEvents.jsx
📚 Learning: 2025-11-17T00:46:30.794Z
Learnt from: tyrrell-IH
Repo: fjordllc/bootcamp PR: 9306
File: app/javascript/components/Bookmarks.jsx:248-265
Timestamp: 2025-11-17T00:46:30.794Z
Learning: fjordllc/bootcamp プロジェクトでは、Reactからバニラ JavaScript への移行作業が進行中である。そのため、新しいReactファイルの作成は避け、既存のReactコンポーネント内で完結する実装が推奨される。BookmarksInDashboard.jsx は issue #9045 で削除予定。

Applied to files:

  • app/javascript/components/BookmarksInDashboard.jsx
🧬 Code graph analysis (3)
app/javascript/components/NotificationsBell/NotificationsBell.jsx (8)
app/javascript/components/Bookmarks.jsx (1)
  • fetcher (8-9)
app/javascript/components/BookmarksInDashboard.jsx (1)
  • fetcher (7-8)
app/javascript/components/Events.jsx (1)
  • fetcher (8-9)
app/javascript/components/Notifications.jsx (1)
  • fetcher (9-10)
app/javascript/components/Products.jsx (1)
  • fetcher (10-11)
app/javascript/components/RegularEvents.jsx (1)
  • fetcher (9-10)
app/javascript/components/Reports.jsx (1)
  • fetcher (10-11)
app/javascript/components/Tags/TagsInput.jsx (1)
  • fetcher (10-10)
app/javascript/components/BookmarksInDashboard.jsx (8)
app/javascript/components/Bookmarks.jsx (1)
  • fetcher (8-9)
app/javascript/components/Events.jsx (1)
  • fetcher (8-9)
app/javascript/components/Notifications.jsx (1)
  • fetcher (9-10)
app/javascript/components/NotificationsBell/NotificationsBell.jsx (1)
  • fetcher (8-8)
app/javascript/components/Products.jsx (1)
  • fetcher (10-11)
app/javascript/components/RegularEvents.jsx (1)
  • fetcher (9-10)
app/javascript/components/Reports.jsx (1)
  • fetcher (10-11)
app/javascript/components/Tags/TagsInput.jsx (1)
  • fetcher (10-10)
app/javascript/components/Notifications.jsx (8)
app/javascript/components/Bookmarks.jsx (1)
  • fetcher (8-9)
app/javascript/components/BookmarksInDashboard.jsx (1)
  • fetcher (7-8)
app/javascript/components/Events.jsx (1)
  • fetcher (8-9)
app/javascript/components/NotificationsBell/NotificationsBell.jsx (1)
  • fetcher (8-8)
app/javascript/components/Products.jsx (1)
  • fetcher (10-11)
app/javascript/components/RegularEvents.jsx (1)
  • fetcher (9-10)
app/javascript/components/Reports.jsx (1)
  • fetcher (10-11)
app/javascript/components/Tags/TagsInput.jsx (1)
  • fetcher (10-10)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (4)
app/javascript/components/NotificationsBell/NotificationsBell.jsx (1)

7-7: LGTM: @rails/request.js の import が正しく追加されています。

このPR全体で統一されたパターンに従っており、問題ありません。

app/javascript/components/RegularEvents.jsx (1)

3-10: Rails request.js を使った fetcher への置き換えは妥当そうです

  • get(url, { responseKind: 'json' }).then((res) => res.json) で JSON を返す実装になっており、useSWR の fetcher として問題なさそうです。
  • res.json をメソッドではなくプロパティとして参照しているのも、Rails request.js の json が getter という過去の知見と一致しています(response.json() ではなく response.json)。retrieved_learnings の方針どおりです。
app/javascript/components/Notifications.jsx (1)

7-10: Notifications の fetcher 差し替えも他コンポーネントと揃っていて問題なさそうです

  • get の導入と const fetcher = (url) => get(url, { responseKind: 'json' }).then((res) => res.json) という実装は、他のコンポーネント(Bookmarks, Events など)と完全に同じ形で、SWR 用の fetcher として妥当だと思います。
  • Rails request.js の json getter を res.json として扱っている点も、既存のプロジェクト方針・過去の PR の learnings と整合しています。
app/javascript/components/BookmarksInDashboard.jsx (1)

3-8: Dashboard 用ブックマークの fetcher 置き換えと import 追加も問題なさそうです

  • get を追加して const fetcher = (url) => get(url, { responseKind: 'json' }).then((res) => res.json) としている点は、他コンポーネントと同じパターンで、Rails request.js の json getter の使い方としても正しいと思います。
  • useSWR(bookmarksUrl, fetcher)mutate(bookmarksUrl) で同じキーを使っており、削除後の再フェッチもこれまでどおり動作しそうです。
  • BookmarksInDashboard.jsx 自体は将来的に削除予定(retrieved_learnings)なので、この PR で過度に抽象化せず最小限の差し替えに留めているのもスコープ的に良さそうです。

@yokomaru yokomaru force-pushed the chore/replace_fetcher_js_with_request_js branch from 746c3bf to 9736834 Compare December 10, 2025 08:40
rails/request.js にAPIフェッチ処理を集約するため、fetcher.js を削除し、利用していた全コンポーネント・ファイルでのインポートと呼び出しをrequest.jsのgetに置き換えた

影響ファイル:
- Bookmarks.jsx, BookmarksInDashboard.jsx, Events.jsx, Notifications.jsx, Products.jsx, RegularEvents.jsx, Reports.jsx, NotificationsBell.jsx,  TagsInput.jsx, tag.js
@yokomaru yokomaru force-pushed the chore/replace_fetcher_js_with_request_js branch from 9736834 to 53c447a Compare December 10, 2025 14:21
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/javascript/tag.js (1)

3-64: タグ候補取得の request.js への移行は正しく行われています

get('/api/tags.json?taggable_type=...', { responseKind: 'json' }) のレスポンスに対して await response.json としており、request.js の FetchResponse.json を getter として扱う正しい形になっています。tagify.whitelist への代入ロジックも既存挙動と同等に見えます。

なお、同ファイル内の PUT /api/... は依然として素の fetch を使っているため、将来的にはこちらも request.js に統一するとコードスタイルとコーディングガイドラインの整合性がより高まりそうです(この PR では現状のままでも良さそうです)。As per coding guidelines, ...

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9736834 and 53c447a.

📒 Files selected for processing (11)
  • app/javascript/components/Bookmarks.jsx (1 hunks)
  • app/javascript/components/BookmarksInDashboard.jsx (1 hunks)
  • app/javascript/components/Events.jsx (1 hunks)
  • app/javascript/components/Notifications.jsx (1 hunks)
  • app/javascript/components/NotificationsBell/NotificationsBell.jsx (1 hunks)
  • app/javascript/components/Products.jsx (1 hunks)
  • app/javascript/components/RegularEvents.jsx (1 hunks)
  • app/javascript/components/Reports.jsx (1 hunks)
  • app/javascript/components/Tags/TagsInput.jsx (1 hunks)
  • app/javascript/fetcher.js (0 hunks)
  • app/javascript/tag.js (2 hunks)
💤 Files with no reviewable changes (1)
  • app/javascript/fetcher.js
🚧 Files skipped from review as they are similar to previous changes (4)
  • app/javascript/components/Bookmarks.jsx
  • app/javascript/components/NotificationsBell/NotificationsBell.jsx
  • app/javascript/components/RegularEvents.jsx
  • app/javascript/components/Tags/TagsInput.jsx
🧰 Additional context used
📓 Path-based instructions (3)
app/**/*.{rb,js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Rails app code should be organized in app/ directory with subdirectories: models/, controllers/, views/, jobs/, helpers/, and frontend code under javascript/ (Shakapacker)

Files:

  • app/javascript/components/Products.jsx
  • app/javascript/components/Events.jsx
  • app/javascript/components/Notifications.jsx
  • app/javascript/components/Reports.jsx
  • app/javascript/tag.js
  • app/javascript/components/BookmarksInDashboard.jsx
app/javascript/**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

JavaScript/TypeScript code in app/javascript/ should be linted with ESLint and formatted with Prettier via yarn lint scripts; use React 17 and Shakapacker/Webpack 5

Files:

  • app/javascript/components/Products.jsx
  • app/javascript/components/Events.jsx
  • app/javascript/components/Notifications.jsx
  • app/javascript/components/Reports.jsx
  • app/javascript/tag.js
  • app/javascript/components/BookmarksInDashboard.jsx
**/*.js

⚙️ CodeRabbit configuration file

**/*.js: - どうしても避けられない時以外に新規にVue.js, Reactのコードを追加しない。

  • fetchメソッドの代わりにrequest.jsを使う。

Files:

  • app/javascript/tag.js
🧠 Learnings (6)
📓 Common learnings
Learnt from: tyrrell-IH
Repo: fjordllc/bootcamp PR: 9306
File: app/javascript/components/Bookmarks.jsx:248-265
Timestamp: 2025-11-17T00:46:30.794Z
Learning: fjordllc/bootcamp プロジェクトでは、Reactからバニラ JavaScript への移行作業が進行中である。そのため、新しいReactファイルの作成は避け、既存のReactコンポーネント内で完結する実装が推奨される。BookmarksInDashboard.jsx は issue #9045 で削除予定。
Learnt from: ryufuta
Repo: fjordllc/bootcamp PR: 9331
File: app/javascript/action_completed_button.js:46-53
Timestamp: 2025-12-04T01:50:46.369Z
Learning: Rails request.js の FetchResponse クラスでは、HTTP ステータスコードは `response.statusCode` プロパティでアクセスする必要がある。`response.status` ではなく `response.statusCode` を使用する。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/notifiers/discord_notifier.rb:131-135
Timestamp: 2025-09-12T21:18:00.834Z
Learning: Rails アップグレードPRにおいて、product_review_not_completed メソッドの webhook URL 設定の shared フォールバック追加も、設定システム全体の変更として別PRで対応すべきである。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 8877
File: app/javascript/check-stamp.js:22-24
Timestamp: 2025-07-04T07:15:17.639Z
Learning: Rails request.jsライブラリでは、FetchResponseクラスのjsonプロパティはgetterとして定義されており、response.json()ではなくresponse.jsonとして使用する必要がある。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/graduation_notifier.rb:23-28
Timestamp: 2025-09-12T21:16:47.639Z
Learning: Rails upgrade PRにおいて、configuration systemの変更やwebhook設定の改善提案も、アップグレードに直接関連しない場合は別PRで対応すべきである。PRのスコープ維持が重要。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 8877
File: app/javascript/watches.js:78-78
Timestamp: 2025-07-26T01:11:03.921Z
Learning: Rails request.jsのFetchResponseクラスでは、text、json、htmlプロパティはgetterとして定義されており、response.text()ではなくresponse.textとしてアクセスする必要がある。getterは自動的にレスポンスをキャッシュし、jsonの場合はContent-Typeの検証も行う。
Learnt from: komagata
Repo: fjordllc/bootcamp PR: 9101
File: app/models/product.rb:59-61
Timestamp: 2025-09-11T14:47:53.256Z
Learning: Rails アップグレードPRでは、アップグレードに直接関連しない性能改善や機能追加の提案は避けるべき。PRのスコープを維持することが重要で、そのような改善提案は別PRで対応すべきである。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-04T07:17:55.949Z
Learning: Rails request.jsのFetchResponseクラスでは、json、text、htmlなどはgetterとして定義されており、response.json()ではなくresponse.jsonとしてアクセスする必要がある。また、getterはContent-Typeの自動チェック機能を含んでいる。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 8877
File: app/javascript/check-stamp.js:22-24
Timestamp: 2025-07-04T07:15:17.639Z
Learning: Rails request.jsライブラリでは、FetchResponseクラスのjsonプロパティはgetterとして定義されており、response.json()ではなくresponse.jsonとして使用する必要がある。また、Content-Typeがapplication/jsonでない場合は自動的にエラーを投げる安全性チェックも含まれている。
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-04T07:17:55.949Z
Learning: Rails request.jsのFetchResponseクラスでは、jsonとtextはgetterとして定義されており、それぞれPromiseを返す。jsongetterは自動的にContent-Typeをチェックし、application/jsonでない場合はエラーを投げる。また、レスポンスは一度パースされるとキャッシュされる仕組みになっている。
📚 Learning: 2025-07-04T07:17:55.949Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2025-07-04T07:17:55.949Z
Learning: Rails request.jsのFetchResponseクラスでは、jsonとtextはgetterとして定義されており、それぞれPromiseを返す。jsongetterは自動的にContent-Typeをチェックし、application/jsonでない場合はエラーを投げる。また、レスポンスは一度パースされるとキャッシュされる仕組みになっている。

Applied to files:

  • app/javascript/tag.js
📚 Learning: 2025-07-26T01:11:03.921Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 8877
File: app/javascript/watches.js:78-78
Timestamp: 2025-07-26T01:11:03.921Z
Learning: Rails request.jsのFetchResponseクラスでは、text、json、htmlプロパティはgetterとして定義されており、response.text()ではなくresponse.textとしてアクセスする必要がある。getterは自動的にレスポンスをキャッシュし、jsonの場合はContent-Typeの検証も行う。

Applied to files:

  • app/javascript/tag.js
📚 Learning: 2025-07-04T07:15:17.639Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 8877
File: app/javascript/check-stamp.js:22-24
Timestamp: 2025-07-04T07:15:17.639Z
Learning: Rails request.jsライブラリでは、FetchResponseクラスのjsonプロパティはgetterとして定義されており、response.json()ではなくresponse.jsonとして使用する必要がある。

Applied to files:

  • app/javascript/tag.js
📚 Learning: 2025-07-04T07:15:17.639Z
Learnt from: Miya096jp
Repo: fjordllc/bootcamp PR: 8877
File: app/javascript/check-stamp.js:22-24
Timestamp: 2025-07-04T07:15:17.639Z
Learning: Rails request.jsライブラリでは、FetchResponseクラスのjsonプロパティはgetterとして定義されており、response.json()ではなくresponse.jsonとして使用する必要がある。また、Content-Typeがapplication/jsonでない場合は自動的にエラーを投げる安全性チェックも含まれている。

Applied to files:

  • app/javascript/tag.js
📚 Learning: 2025-11-17T00:46:30.794Z
Learnt from: tyrrell-IH
Repo: fjordllc/bootcamp PR: 9306
File: app/javascript/components/Bookmarks.jsx:248-265
Timestamp: 2025-11-17T00:46:30.794Z
Learning: fjordllc/bootcamp プロジェクトでは、Reactからバニラ JavaScript への移行作業が進行中である。そのため、新しいReactファイルの作成は避け、既存のReactコンポーネント内で完結する実装が推奨される。BookmarksInDashboard.jsx は issue #9045 で削除予定。

Applied to files:

  • app/javascript/components/BookmarksInDashboard.jsx
🧬 Code graph analysis (2)
app/javascript/components/Reports.jsx (8)
app/javascript/components/Bookmarks.jsx (1)
  • fetcher (8-9)
app/javascript/components/BookmarksInDashboard.jsx (1)
  • fetcher (7-8)
app/javascript/components/Events.jsx (1)
  • fetcher (8-9)
app/javascript/components/Notifications.jsx (1)
  • fetcher (9-10)
app/javascript/components/NotificationsBell/NotificationsBell.jsx (1)
  • fetcher (8-9)
app/javascript/components/Products.jsx (1)
  • fetcher (10-11)
app/javascript/components/RegularEvents.jsx (1)
  • fetcher (9-10)
app/javascript/components/Tags/TagsInput.jsx (1)
  • fetcher (10-11)
app/javascript/components/BookmarksInDashboard.jsx (8)
app/javascript/components/Bookmarks.jsx (1)
  • fetcher (8-9)
app/javascript/components/Events.jsx (1)
  • fetcher (8-9)
app/javascript/components/Notifications.jsx (1)
  • fetcher (9-10)
app/javascript/components/NotificationsBell/NotificationsBell.jsx (1)
  • fetcher (8-9)
app/javascript/components/Products.jsx (1)
  • fetcher (10-11)
app/javascript/components/RegularEvents.jsx (1)
  • fetcher (9-10)
app/javascript/components/Reports.jsx (1)
  • fetcher (10-11)
app/javascript/components/Tags/TagsInput.jsx (1)
  • fetcher (10-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (5)
app/javascript/components/Products.jsx (1)

7-11: request.js を使った fetcher への置き換えは妥当です

get(url, { responseKind: 'json' }) に対して res.json をプロパティ参照しており、request.js の FetchResponse.json の仕様に沿った書き方になっています。既存の fetcher と同等の振る舞いになりそうで、特に懸念ありません。Based on learnings, ...

app/javascript/components/Events.jsx (1)

6-9: Events の fetcher 置き換えも一貫していて問題ありません

get の導入と const fetcher = (url) => get(url, { responseKind: 'json' }).then((res) => res.json) への差し替えは、他コンポーネントと同じパターンで、SWR の呼び出し側もそのままなので挙動は維持できていそうです。Based on learnings, ...

app/javascript/components/BookmarksInDashboard.jsx (1)

3-8: Dashboard 用ブックマークの取得も request.js ベースに正しく移行できています

get を使った fetcher の定義と、destroy の import 元を request.js に揃えたことで、取得・削除ともに同じライブラリに統一されており、SWR・mutate 周りのフローも従来どおり維持できていそうです。As per coding guidelines, ...

app/javascript/components/Notifications.jsx (1)

7-10: 通知一覧の fetcher 置き換えは SWR パターンと整合しています

apiUrl を SWR のキー関数として渡しつつ、fetcher を request.js ベースに差し替えており、res.json をプロパティとして扱う形も他ファイルと揃っているため、不整合はなさそうです。Based on learnings, ...

app/javascript/components/Reports.jsx (1)

3-11: 日報一覧の fetcher も request.js ベースに問題なく差し替えられています

get(url, { responseKind: 'json' }).then((res) => res.json) によるローカル fetcher 定義は、他コンポーネントと同じパターンで、request.js の json getter 仕様にも沿っているため、この置き換えによる挙動差はほぼなく安全そうです。Based on learnings, ...

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