Bug fix bf-2vkw: Fix replay viewer blank when navigating to /watch/replay/:id directly

When navigating to /watch/replay/:id (e.g., from the "Closest Match" link in rivalries), params.url was undefined, causing the viewer to show "Enter a replay URL to load" message. Fixed by constructing the URL from params.id when params.url is not set, using the pattern /r2/replays/MATCHID.json.gz.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-05-13 18:26:19 -04:00
parent bb3c6d8d64
commit 60531c66f2

View file

@ -45,7 +45,9 @@ export function renderReplayPage(params: Record<string, string>): void {
`;
loadReplayViewer().then(({ ReplayViewer }) => {
initReplayViewerWithClass(ReplayViewer, params.url);
// If params.url is not set but params.id is, construct the URL from the match ID
const replayUrl = params.url || (params.id ? `/r2/replays/${params.id}.json.gz` : undefined);
initReplayViewerWithClass(ReplayViewer, replayUrl);
});
}