-
Notifications
You must be signed in to change notification settings - Fork 75
fetcher.jsを廃止しrequest.jsに処理を統一 #9334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Walkthrough複数のフロントエンドコンポーネントが共通の Changes
Estimated code review effort🎯 3 (中程度) | ⏱️ ~20 分
Possibly related issues
Possibly related PRs
Suggested reviewers
詩
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
0375a84 to
746c3bf
Compare
There was a problem hiding this 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 の
jsongetter を適切に使用しています(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
📒 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 underjavascript/(Shakapacker)
Files:
app/javascript/components/RegularEvents.jsxapp/javascript/components/NotificationsBell/NotificationsBell.jsxapp/javascript/components/BookmarksInDashboard.jsxapp/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 viayarn lintscripts; use React 17 and Shakapacker/Webpack 5
Files:
app/javascript/components/RegularEvents.jsxapp/javascript/components/NotificationsBell/NotificationsBell.jsxapp/javascript/components/BookmarksInDashboard.jsxapp/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 の
jsongetter を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 のjsongetter の使い方としても正しいと思います。useSWR(bookmarksUrl, fetcher)とmutate(bookmarksUrl)で同じキーを使っており、削除後の再フェッチもこれまでどおり動作しそうです。- BookmarksInDashboard.jsx 自体は将来的に削除予定(retrieved_learnings)なので、この PR で過度に抽象化せず最小限の差し替えに留めているのもスコープ的に良さそうです。
746c3bf to
9736834
Compare
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
9736834 to
53c447a
Compare
There was a problem hiding this 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
📒 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 underjavascript/(Shakapacker)
Files:
app/javascript/components/Products.jsxapp/javascript/components/Events.jsxapp/javascript/components/Notifications.jsxapp/javascript/components/Reports.jsxapp/javascript/tag.jsapp/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 viayarn lintscripts; use React 17 and Shakapacker/Webpack 5
Files:
app/javascript/components/Products.jsxapp/javascript/components/Events.jsxapp/javascript/components/Notifications.jsxapp/javascript/components/Reports.jsxapp/javascript/tag.jsapp/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, ...
Issue
概要
fetcher.jsではなくrails/request.jsに置き換えるfetcher.jsファイル自体を削除影響ファイル
実装方針
fetcher.jsの削除を優先するfetcher.jsを使用している既存の13箇所に直接ロジックを記述するrails/request.jsはjsonをgetterとして定義している(参考)ため、.then(res => res.json)のような記述となっている(関数参照をしているわけではない)変更確認方法
chore/replace_fetcher_js_with_request_jsをローカルに取り込むどのユーザーでもOK
Bookmarks.jsx
BookmarksInDashboard.jsx
Notifications.jsx
NotificationsBell.jsx
RegularEvents.jsx
Reports.jsx
TagsInput.jsx
tag.js
管理者権限で確認
Screenshot
見た目の変更はありません。
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.