Skip to content

refactor(config): share config screen between routes - #575

Merged
hmjn023 merged 1 commit into
developfrom
fix/config-route-shared
Jul 5, 2026
Merged

refactor(config): share config screen between routes#575
hmjn023 merged 1 commit into
developfrom
fix/config-route-shared

Conversation

@hmjn023

@hmjn023 hmjn023 commented Jul 5, 2026

Copy link
Copy Markdown
Owner

概要

config画面の server/tauri 重複を除去し、共有 ConfigScreen を直接使うようにしました。

変更内容

  • apps/server と apps/tauri の config ルートを共有 UI に統一
  • 不要になった -config-form.tsx を削除
  • Tauri 側の no-op resetThumbnailRuntimeCache を削除

Summary by CodeRabbit

  • 新機能
    • 設定画面が新しい画面コンポーネントに切り替わり、設定の更新操作がより明確になりました。
  • バグ修正
    • 設定を保存したあと、最新の内容が自動的に再取得されるようになりました。
    • リモートサーバーモードでのサムネイル通知処理が安定化しました。

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

server と tauri の設定ルートで ConfigForm コンポーネントが削除され、ConfigScreen に置き換えられた。両ルートで useQueryClient を使い、orpc.config.update 実行後に ["config"] クエリを無効化する処理が明示的に実装された。また thumbnail-runtime.tsresetThumbnailRuntimeCache が削除され、ノーオペの notifyThumbnailReady が追加された。

Changes

設定画面のコンポーネント移行

Layer / File(s) Summary
server 側 ConfigPage の ConfigScreen 移行
apps/server/src/routes/config.tsx, apps/server/src/routes/config/-config-form.tsx
ConfigForm を削除し ConfigScreen へ置換、useQueryClient を用いて orpc.config.update 後に ["config"] クエリを無効化する処理を追加。
tauri 側 ConfigPage の ConfigScreen 移行
apps/tauri/src/routes/config.tsx, apps/tauri/src/routes/config/-config-form.tsx
ConfigForm を削除し ConfigScreen へ置換、同様に useQueryClientorpc.config.update によるクエリ無効化フローを実装。
thumbnail-runtime の公開関数変更
apps/tauri/src/infrastructure/media/thumbnail-runtime.ts
resetThumbnailRuntimeCache を削除し、ノーオペの notifyThumbnailReady(mediaId) を新規追加。

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: 設定データ再取得
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed サーバーとTauriの両方でConfigScreenを共有するリファクタリング内容を適切に表しています。
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/config-route-shared

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 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.tsconfigQueryKeys.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

📥 Commits

Reviewing files that changed from the base of the PR and between 7853fce and 6243251.

📒 Files selected for processing (5)
  • apps/server/src/routes/config.tsx
  • apps/server/src/routes/config/-config-form.tsx
  • apps/tauri/src/infrastructure/media/thumbnail-runtime.ts
  • apps/tauri/src/routes/config.tsx
  • apps/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

@hmjn023
hmjn023 merged commit da8e900 into develop Jul 5, 2026
1 check passed
@hmjn023
hmjn023 deleted the fix/config-route-shared branch July 5, 2026 06:59
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.

1 participant