バグ:戦闘中のpauseメニューのキャラクターアイコンパスがおかしい
Comments (3)
適切な箇所に console.log 差し込んで 解析 対応していく
原因
/Users/creonewin2/dev/project/instansys/ultemist/260225/ultemist/apps/client/src/scenes/Battle.tsx:1106-1115
const portraitUrls = master?.picturePath
? resolveLayeredPictureUrls(master.picturePath)
: [];
return {
...
portraitPath: portraitUrls[0] ?? "", // ← Supabase URL が入る
};
resolveLayeredPictureUrls は @repo/shared の関数で、LunaEditor用の Supabase に保存された立ち絵画像のフルURL を返します(他の使用例: Home / ChapterResult / Gacha など、すべて <img src={url}> で直接表示している)。
一方、<CharacterCard characterImagePath={...}> の useImageCache は CDN(R2)上の暗号化アセットの相対パス を期待しています(getCdnUrl で assetsOrigin を前置 → 復号化処理)。
→ 設計が違う2種類の画像URLが混線している
Battle.tsx 1111行目あたり
"portraitPath: portraitUrls[0] ?? "","
とあるが、本来は、ポートレートでは、なく、iconPath であるべき
周辺の論理も、 portraitPath で 構成されており、一旦、バグfix にフォーカスすれば、
"portraitPath: master?.iconPath ?? "","
としておく。
また、本来は、portraitPath ではなく、iconPath として定義すべきで、
そうすると、修正範囲が広がるので、一旦、"portraitPath: master?.iconPath ?? ""," で バグFix / PRしておく。
ここをiconPath にリネームして論理修正する場合、
apps/client/src/scenes/Battle/PauseModal.tsx:135 の型定義と、関連箇所を一括変更する形になります:
- PauseModal.tsx:135 portraitPath: string; → iconPath: string;
- PauseModal.tsx:302, 332 characterImagePath={char.portraitPath} → characterImagePath={char.iconPath}
- Battle.tsx:1115 portraitPath: master?.iconPath ?? "" → iconPath: master?.iconPath ?? ""
- BattleUIPreview.tsx:41 portraitPath: "" → iconPath: ""