fix: インポート/バックアップ復元と sync ストレージ書き込みの不具合修正 - #466
Conversation
An outdated service worker can answer resolveIconColors with null, which left the menu stuck in the loading state. Render unanswered icons with the default colors instead, while still leaving them uncached so the next menu retries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Move React-independent import/export/backup logic to services/settings/importExport.ts - Add useImportExport hook that only holds state and wires service calls - Keep ImportExport.tsx focused on rendering - Add unit tests for the importExport service Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Backups with an empty commands array were shown as restorable but always failed to restore. Treat them as unavailable instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
debouncedSyncSet cleared the pending buffer and resolved all waiting promises when a write completed, so data added while chrome.storage.sync.set was in flight was silently dropped. Detach the batch when the write starts and serialize writes so later batches land after earlier ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
レビュー結果全体として、 気になった点
良かった点
テストカバレッジ
🤖 Generated with Claude Code |
Replace the callback API with async/await. Errors are caught and logged so waiting callers still resolve and the write chain keeps running after a failed write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An invalid JSON file caused an unhandled rejection with no feedback. Catch the error, alert the user and clear the previously selected file so it is not imported by mistake. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
コードレビュー結果全体として、 良い点
気になった点(軽微)
まとめ
🤖 Generated with Claude Code |
コードレビュー結果
気になった点
良かった点(参考)
テストカバレッジ
🤖 Generated with Claude Code |
概要
設定のインポートがうまく動作しない不具合の調査に伴う、リファクタリングと関連不具合の修正です。
変更内容
refactor: ImportExport を service / hook / view に分割
services/settings/importExport.tsへ移動hooks/option/useImportExport.tsを追加components/option/ImportExport.tsxはレンダリングのみを担当importExport.tsのユニットテストを追加fix: コマンドが0件のバックアップを復元候補から除外
commands: []のバックアップが選択可能なのに、復元すると必ず失敗していたfix: sync ストレージの書き込み中に追加されたデータが失われる問題
debouncedSyncSetは書き込み完了時にバッファを丸ごとクリアし、待機中の Promise をすべて resolve していたため、chrome.storage.sync.setの実行中に追加されたデータが書き込まれずに消え、呼び出し元にも成功が返っていたその他
110f1583 fix: fall back to default icon colors when resolveIconColors failsも未マージのため本 PR に含まれていますテスト
yarn test(extension): 全件パスtsc --noEmit: エラーなし🤖 Generated with Claude Code