Repository navigation
fix(marketing): skip the API read for a malformed fight handle - #8817
Conversation
The fight page sent the raw ?a= and ?b= values to leaderboard.public.participant. A value the handle schema refuses came back as BAD_REQUEST, which fetchParticipant rethrows, so the page render failed. Check the handle with isProfileHandle, the same check the proxy uses for profile routes, and show an empty slot. Refs MARKETING-6C
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
[Low impact] The PR appears safe to merge. SummaryThe fight page now checks query handles before fetching a participant.
Reviews (1) · Last reviewed commit: "fix(marketing): skip the API read for a ..." · Reviewed by Greptile |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Problem
/fight?a=…&b=…failed to render when a query value was not a valid leaderboard handle, for example a handle with a trailing)from a pasted link. The server render threw an unhandled tRPC input-validation error.Root cause
resolveFightersent the raw query value toleaderboard.public.participant. That procedure'shandleSchemarefuses anything outsideHANDLE_PATTERN, or a reserved handle, withBAD_REQUEST.fetchParticipantreturnsnullonly forNOT_FOUNDand rethrows all other errors, so the render failed. #7295 fixed the same problem for profile routes: there the proxy routes to a profile only whenisProfileHandlepasses. The fight page had no such check.Fix
Use the same
isProfileHandlecheck inresolveFighterbefore the API read. If the handle is not valid, that slot is empty, which is what a missing profile already shows.Verification
Refs MARKETING-6C
Summary by cubic
Fixes the
/fightpage render failing when a query value is not a valid leaderboard handle.resolveFightersent the raw value toleaderboard.public.participant, which rejects malformed handles (like pasted links with a trailing)) withBAD_REQUEST;fetchParticipantrethrows everything exceptNOT_FOUND, so the page crashed.The page now uses the same
isProfileHandlecheck used for profile routes before the API read. Invalid handles render as an empty slot, matching the missing-profile state.Written for commit a102ea1. Summary will update on new commits.
Summary by CodeRabbit