設定画面のオーバーレイとモデル読み込み表示を改善#562
Conversation
Walkthrough共通の Changesモデル読込オーバーレイと関連修正
話者更新エラー処理と Aivis API 検証
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/components/modelLoadingOverlay.tsx (1)
9-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
aria-labelの言語がアプリの他の文言と不整合。
aria-label="Loading model"が英語のままですが、アプリ内の他の読み込み表示(例: PNGTuberComponent の旧「読み込み中...」)は日本語です。日本語スクリーンリーダー利用者向けに一貫性を持たせるべきです。♻️ 修正例
- aria-label="Loading model" + aria-label="モデルを読み込み中"🤖 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 `@src/components/modelLoadingOverlay.tsx` around lines 9 - 13, `ModelLoadingOverlay` の `aria-label` が英語のままなので、アプリ内の他の読み込み文言と合わせて日本語に統一してください。`src/components/modelLoadingOverlay.tsx` の `Loading model` を、スクリーンリーダー向けに自然な日本語の読み込み表示へ置き換え、`role="status"` と併せて一貫したアクセシブルな文言になるよう修正してください。
🤖 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.
Inline comments:
In `@src/features/vrmViewer/viewer.ts`:
- Around line 67-69: In the async load callback inside viewer.ts, the early
return path after checking this.model !== model should not discard an
already-loaded VRM without cleanup. Update the logic around the Promise.then
handler in the viewer model loading flow so that, before returning for a stale
model, the current model’s loaded VRM is released via model.unLoadVrm(); keep
the existing guard with this.model and model.vrm, but ensure outdated loads are
explicitly disposed first.
In `@src/styles/globals.css`:
- Around line 129-133: The .theme-settings-backdrop style is using a hardcoded
white rgba background, so update this selector to use a CSS variable instead of
a fixed color. Define a theme-aware variable such as --settings-backdrop-bg in
the root and dark theme selectors, then reference it from
.theme-settings-backdrop so the backdrop adapts correctly for light and dark
modes. Keep the existing blur settings and adjust only the background color
source.
---
Nitpick comments:
In `@src/components/modelLoadingOverlay.tsx`:
- Around line 9-13: `ModelLoadingOverlay` の `aria-label`
が英語のままなので、アプリ内の他の読み込み文言と合わせて日本語に統一してください。`src/components/modelLoadingOverlay.tsx`
の `Loading model` を、スクリーンリーダー向けに自然な日本語の読み込み表示へ置き換え、`role="status"`
と併せて一貫したアクセシブルな文言になるよう修正してください。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: d29690b3-ee6c-4904-b458-48d214d020c7
📒 Files selected for processing (9)
src/components/Live2DComponent.tsxsrc/components/PNGTuberComponent.tsxsrc/components/live2DViewer.tsxsrc/components/modelLoadingOverlay.tsxsrc/components/pngTuberViewer.tsxsrc/components/settings/index.tsxsrc/components/vrmViewer.tsxsrc/features/vrmViewer/viewer.tssrc/styles/globals.css
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/pages/api/update-aivis-speakers.ts`:
- Around line 63-73: Add the same response-shape guard in the VoiceVox speakers
update flow as in the AivisSpeech handler: after the `response.ok` check in
`update-voicevox-speakers.ts`, validate that the parsed `speakers` value is an
array with `Array.isArray(speakers)` before any `flatMap` usage. If it is not an
array, throw a clear error like the one used in the `update-aivis-speakers` path
so the API fails fast on invalid upstream responses.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2e8f73f2-11f7-48e6-9137-b765a5899ab7
📒 Files selected for processing (4)
src/__tests__/components/voice.test.tsxsrc/__tests__/pages/api/update-aivis-speakers.test.tssrc/components/settings/voice.tsxsrc/pages/api/update-aivis-speakers.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/pages/api/update-voicevox-speakers.ts (1)
70-81: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value配列チェックに加えて個々の要素の形状検証も検討してください。
speakersが配列であることは検証していますが、各要素のstylesが配列であるかは未検証です。stylesが欠落・不正な場合はflatMap内でTypeErrorが発生し、catch ブロックで捕捉されて 500 になりますが、エラーメッセージが実際の原因を反映しません。♻️ 個々の要素検証を追加する例
const speakers: Speaker[] = await response.json() if (!Array.isArray(speakers)) { throw new Error('VOICEVOX speakers response must be an array') } + if (speakers.some((speaker) => !Array.isArray(speaker?.styles))) { + throw new Error('VOICEVOX speaker styles must be an array') + }🤖 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 `@src/pages/api/update-voicevox-speakers.ts` around lines 70 - 81, The VOICEVOX speaker normalization in update-voicevox-speakers should validate each Speaker item’s shape, not just the top-level array. Update the speakers.flatMap transformation to check that speaker.styles is an array before iterating, and throw a descriptive error when a speaker entry is missing or has invalid styles so the catch path reports the real cause instead of a generic TypeError. Use the Speaker and VoicevoxSpeaker handling in update-voicevox-speakers as the place to add this per-item validation.
🤖 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 `@src/pages/api/update-voicevox-speakers.ts`:
- Around line 70-81: The VOICEVOX speaker normalization in
update-voicevox-speakers should validate each Speaker item’s shape, not just the
top-level array. Update the speakers.flatMap transformation to check that
speaker.styles is an array before iterating, and throw a descriptive error when
a speaker entry is missing or has invalid styles so the catch path reports the
real cause instead of a generic TypeError. Use the Speaker and VoicevoxSpeaker
handling in update-voicevox-speakers as the place to add this per-item
validation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 8d7d648d-feec-49f8-b69e-ac8f4c27a122
📒 Files selected for processing (2)
src/__tests__/pages/api/update-voicevox-speakers.test.tssrc/pages/api/update-voicevox-speakers.ts
概要
検証
備考
Summary by CodeRabbit