Files
mtg-online-drafter/docs/development/devlog/2025-12-14-230000_fix_draft_images.md

1.1 KiB

Fix Draft Card Images

Issue

Users reported that images were not showing in the Draft Card Selection UI.

Root Causes

  1. Missing Proxy: The application was attempting to load cached images from http://localhost:5173/cards/.... Vite Dev Server (port 5173) was not configured to proxy these requests to the backend (port 3000), resulting in 404 errors for all local images.
  2. Incorrect Property Access: DraftView.tsx (and DeckBuilderView.tsx) attempted to access card.image_uris.normal. However, the DraftCard object generated by PackGeneratorService and modified by LobbyManager stores the image URL in card.image. This property was being ignored.

Fixes

  1. Vite Config: Added a proxy rule for /cards in src/vite.config.ts to forward requests to http://localhost:3000.
  2. Frontend Views: Updated DraftView.tsx and DeckBuilderView.tsx to prioritize card.image when rendering card images.

Verification

  • Start the draft.
  • Images should now load correctly from the local cache (or fallback if configured).
  • Inspect network tab to verify images are loaded from /cards/... with a 200 OK status.