refactor(web): 非同期操作・削除確認・保存・polling・整形・検索の重複を 1 つの実装に寄せる - #73
Merged
Merged
Conversation
…統一する - settings/diagnostics/connections/sync の 7 画面が busy・error・saved を それぞれ useState で持っていたのを `ui/useAsyncOperation` に寄せ、 `settings/useSaveState` を削除する - Vault の資格情報・スニペット・保存レイアウトは確認なしで即時削除していた。 ショートカットプリセットだけがインラインの確認 UI だった。4 つとも `ConfirmDialog` を出してから削除する - 保存レイアウトの削除失敗を他の操作と同じく画面に出す(従来は握りつぶし) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…umnWidth に統一する - theme・locale・Quick Connect の表示形式・転送一覧の高さ・SFTP ペインが それぞれ try/catch 付きで localStorage を触っていたのを `readStoredValue`/`writeStoredValue`/`readStoredJSON` にまとめる - `shell/navigationLayout` の detect/remember/clamp は `ui/useStoredColumnWidth` と同じ責務だったので、ナビゲーション列も 同じ hook を使い、navigationLayout は幅の定義(key と範囲)だけにする - hook の引数は 4 つの位置引数から `StoredColumnWidth` の名前付き引数にし、 hook を ColumnResizeHandle(コンポーネント)から別ファイルへ出す Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
転送台帳・端末セッション一覧・スニペット実行・同期バケット・ショートカット
プリセットの 5 箇所が setInterval を手書きし、非表示中の抑止と重複実行の
防止の有無がばらばらだった。`usePolling(tick, { intervalMs, enabled,
whileHidden, immediately })` に寄せ、前回の tick が終わるまで次を始めない。
非表示中も続けるかは各サイトが明示する(転送・端末・実行中コマンド・
プリセットは続け、バケット一覧は止める)。
Vault 状態の確認(useAppSession)は可視化・フォーカスの再確認と一体なので
そのまま残した。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… に寄せる
`api/config.ts` が `guards.postJSON` と同名の独自実装を持ち、PUT/PATCH は
各 API ファイルが `Content-Type` を直書きしていた。JSON を送る mutation は
`sendJSON(path, { method, body, actionToken, locallyHandledCodes })` を
通し、`postJSON`/`putJSON`/`patchJSON` はその薄い包みにする。
config・sync・credentials・vault・terminalSessions・keys・remotekeys を移行。
`api/settings.ts`・`sftp/api.ts`・`snippets/api.ts` は open な PR #68 と
重なるため、そのマージ後に移す。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- パネル直下のエラー表示は 8 箇所が `role="alert"` の <p> を手書きし、 色(注意色/危険色)と余白がまちまちだった。`Notice tone="danger"` に 寄せ、密な一覧向けに `compact` を足す。フィールド直下の 1 行エラーは そのまま - `formatBytes` が sftp(2 進・小数 1 桁)、sync(10 進・locale)、 BackgroundPicker(2 進・丸め違い)の 3 実装だった。`ui/format.ts` の 1 つにし、単位系(binary/decimal)と locale を引数で選ぶ。 `formatConnectedAt` の完全コピー 2 つと sync の `formatMoment` は `formatDateTime` にする Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- `session.alias ?? session.title`/"localhost" の導出が 5 箇所にあり、 未保存時に空文字を返す所と title を返す所、localhost を i18n する所と 直書きする所が混在していた。`terminalSubtitle(session, translate?)` に 寄せる - ホスト検索の述語が接続ツリー・Quick Connect・ホストピッカーで別々に 書かれ、見る項目が違った。`connections/hostSearch` の `hostMatchesQuery(fields, normalizedQuery)` に統一し、各画面は持っている 項目を渡す - `ConnectionTree` の `nearestParent` は `connectionBrowser` の `nearestDeclaredParent` の完全コピーだったので export して使う Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- `browser.*`・`home.*`・`tree.*`・`secrets.*` ほか、どの画面からも参照されない 54 キーを ja/en から削除する - 英語 UI だけ同じ画面で console と session が混在していた(ja は 「セッション」「ターミナル」で統一済み)。ja に合わせ、開いているものは session、画面や外観は terminal と呼ぶ。E2E と単体テストの期待文言も更新 - ロック画面の言語切替が "English"/"日本語" を直書きしていたので、 MenuPanel と同じ `shell.languageEnglish`/`shell.languageJapanese` を `i18n/locale` の `localeLabelKeys` から引く Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`SFTPSearchModel`/`SFTPTransfersModel`(参照なし)、`App.tsx` の `vaultStatePollIntervalMs`/`resolveOSC52` 再 export(App.test だけが使う)、 `GroupsPanel` の `isValidGroupName` 再 export と `depthOf` の export を 削除する。テストは定義元から直接 import する。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`api/settings.ts`・`sftp/api.ts`・`snippets/api.ts`・`features/workspaces` の JSON を送る mutation を `postJSON`/`putJSON`/`patchJSON` に、 `keyconfig` が独自に持っていた storage の try/catch 包みを `ui/browserStorage` に置き換える。`jsonHeaders` を直接使うのは octet-stream や `apiClient.send` を使う特殊な呼び出しだけになる。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
aida0710
force-pushed
the
agent/web-dedup
branch
from
September 18, 2026 07:31
255ebd7 to
42c72f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
2026-09-18 の監査 H12・H13・M33〜M41(Web の重複実装)の対応です。動作の変更は削除確認の追加とエラー表示の色だけで、ほかは同じ振る舞いを 1 つの実装に寄せています。
useStateで持っていたのをui/useAsyncOperationに集約。settings/useSaveStateは削除。ConfirmDialogを出してから削除します。保存レイアウトの削除失敗は握りつぶしていたので、他の操作と同じく画面に出します。ui/browserStorageに。shell/navigationLayoutの detect/remember/clamp はuseStoredColumnWidthと同責務だったので統合し、hook は名前付き引数(StoredColumnWidth)にしてコンポーネントと別ファイルへ。ui/usePollingに。前回の tick 完了まで次を始めず、非表示中に続けるかは各サイトが明示。間隔はすべて理由付きの名前付き定数に。Vault 状態の確認(useAppSession)は可視化・フォーカスの再確認と一体なので残しています。api/config.tsのpostJSONshadow を削除し、JSON を送る mutation をguards.sendJSON経由に。Content-Type直書きを config・sync・credentials・vault・terminalSessions・keys・remotekeys から除去。Notice tone="danger"(密な一覧向けにcompactを追加)に統一。色は危険色に揃えました。formatBytes3 実装を 1 つに(binary/decimal と locale を引数で選択。ファイルサイズは小数 1 桁固定、S3 の容量は可変で従来表示を維持)。formatConnectedAtのコピー 2 つと sync のformatMomentはformatDateTimeに。nearestParentの完全コピーをそれぞれ 1 つに。localeLabelKeysから。SFTPSearchModel/SFTPTransfersModel、App.tsxのテスト専用再 export、GroupsPanelの再 export を削除。#68・#71 のマージ後に rebase し、保留にしていた
api/settings.ts・sftp/api.ts・snippets/api.ts・features/workspacesのsendJSON移行と、keyconfigの storage 包みのbrowserStorage置き換えも入れました。残した点:
eslint-disable(react-hooks/exhaustive-deps)14 箇所の見直し、ConnectionsPage/KeysScreenの大きな関数の分割、api/settings.tsの手パースを validator に置き換える件。検証:
tsc、eslint、Web 単体 1364 件、E2E 全 37 spec(178 件)を隔離 engine+Chromium で通過、UI dist 再生成。🤖 Generated with Claude Code