refactor(config): share config screen between routes - #575
Conversation
📝 WalkthroughWalkthroughserver と tauri の設定ルートで Changes設定画面のコンポーネント移行
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant ConfigScreen
participant ConfigPage
participant orpc
participant queryClient
ConfigScreen->>ConfigPage: onSubmit(value)
ConfigPage->>orpc: config.update(value)
orpc-->>ConfigPage: 更新完了
ConfigPage->>queryClient: invalidateQueries(["config"])
queryClient-->>ConfigScreen: 設定データ再取得
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/server/src/routes/config.tsx (1)
30-38: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winクエリキーのハードコードは共有定数を再利用すべき
queryKey: ["config"]がリテラルでハードコードされていますが、packages/ui/src/query-options/config-query.tsにconfigQueryKeys.all()(["config"] as const)という正規のキー定義が既に存在します。現状は値が一致しているため機能はしますが、将来キー構造が変わった際に一方だけ更新漏れが起きるリスクがあります。♻️ 提案: 共有のクエリキー定数を再利用
import { ConfigScreen } from "`@solid-imager/ui/screens/config-screen`"; import { createQuery, useQueryClient } from "`@tanstack/solid-query`"; import { createFileRoute } from "`@tanstack/solid-router`"; import { Show } from "solid-js"; import { orpc } from "~/infrastructure/api-clients/orpc-client"; +import { configQueryKeys } from "`@solid-imager/ui/query-options/config-query`"; import { configQueryOptions } from "~/infrastructure/api-clients/queries";onSubmit={async (value) => { await orpc.config.update(value); - await queryClient.invalidateQueries({ queryKey: ["config"] }); + await queryClient.invalidateQueries({ queryKey: configQueryKeys.all() }); }}正確なエクスポートパスは
@solid-imager/uiパッケージの構成に依存するため要確認です。🤖 Prompt for 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. In `@apps/server/src/routes/config.tsx` around lines 30 - 38, The config invalidation in the onSubmit handler currently hardcodes the query key as ["config"]; replace it with the साझा key from configQueryKeys.all() so the route in ConfigScreen stays aligned with the canonical definition. Update the queryClient.invalidateQueries call to use the shared export from the `@solid-imager/ui` config query options instead of an inline literal, preserving consistency if the key shape changes.
🤖 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.
Nitpick comments:
In `@apps/server/src/routes/config.tsx`:
- Around line 30-38: The config invalidation in the onSubmit handler currently
hardcodes the query key as ["config"]; replace it with the साझा key from
configQueryKeys.all() so the route in ConfigScreen stays aligned with the
canonical definition. Update the queryClient.invalidateQueries call to use the
shared export from the `@solid-imager/ui` config query options instead of an
inline literal, preserving consistency if the key shape changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a5729362-c05f-46c4-b431-923bafb88300
📒 Files selected for processing (5)
apps/server/src/routes/config.tsxapps/server/src/routes/config/-config-form.tsxapps/tauri/src/infrastructure/media/thumbnail-runtime.tsapps/tauri/src/routes/config.tsxapps/tauri/src/routes/config/-config-form.tsx
💤 Files with no reviewable changes (3)
- apps/tauri/src/routes/config/-config-form.tsx
- apps/tauri/src/infrastructure/media/thumbnail-runtime.ts
- apps/server/src/routes/config/-config-form.tsx
概要
config画面の server/tauri 重複を除去し、共有 ConfigScreen を直接使うようにしました。
変更内容
Summary by CodeRabbit