AI Review Center
Commit Review Workspace ?
Select a commit on the left to inspect quality, security, business value, findings, and suggested code changes.
Project AI Score
?
72%
Quality Avg
?
77%
Security Avg
?
64%
Reviews
?
91
Review Result ?
solutionbowl/super-admin · f790f431
This commit adds fetching and normalization of net bets data in two components, improving data handling and UI reactivity with useQuery hooks. The normalization functions are robust in handling varied response shapes. However, the commit message is uninformative, and some minor function duplications exist between files. There is also no explicit error handling or input validation in fetch functions which could reduce robustness.
Quality
?
85%
Security
?
60%
Business Value
?
70%
Maintainability
?
83%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Uninformative Message
Where
commit message
Issue / Evidence
uninformative message
Suggested Fix
provide a detailed summary of the changes and reasons to improve business value and code review clarity
Duplicate Logic
Where
src/routes/net-exposure-detail.tsx:1070
Issue / Evidence
duplicated normalization function
Suggested Fix
consider abstracting normalizeNetBetsResponse to a shared utility to improve maintainability
Duplicate Logic
Where
src/routes/user-exposure-detail.tsx:1116
Issue / Evidence
duplicated normalization function
Suggested Fix
consolidate with net-exposure-detail normalization for code reuse and consistency
Lack Of Error Handling In Async Fetchnetbe...
Where
src/routes/net-exposure-detail.tsx:146
Issue / Evidence
lack of error handling in async fetchNetBets
Suggested Fix
add try-catch and error management to reduce bug risk
Missing Validation
Where
src/routes/user-exposure-detail.tsx:155
Issue / Evidence
lack of input validation and error handling in fetchNetBets
Suggested Fix
add validation and error handling to improve quality and reduce bug risk
Getarray Returns Empty Array On Invalid In...
Where
src/routes/net-exposure-detail.tsx:1142
Issue / Evidence
getArray returns empty array on invalid input but no logging
Suggested Fix
consider logging or error reporting when payload structure is unexpected to help debugging
Duplicate Logic
Where
src/routes/user-exposure-detail.tsx:1203
Issue / Evidence
getArray duplicates function in net-exposure-detail.tsx
Suggested Fix
share implementation to reduce maintenance overhead
Code Change Preview · src/routes/net-exposure-detail.tsx
?
Removed / Before Commit
- diff --git a/src/routes/net-exposure-detail.tsx b/src/routes/net-exposure-detail.tsx - index da1c9d1..3505bc2 100644 - marketId: string, - parentUserId?: string, - ): Promise<DetailData> { - const res = (await tenantApiClient.post<unknown>("/horse-racing/reports/net-exposure/detail", { - raceId, - marketId, - ...(parentUserId ? { parentUserId } : {}), - return (res?.data ?? res) as DetailData; - } - - async function fetchOdds(raceId: string): Promise<OddsMarket[]> { - const res = (await tenantApiClient.get<unknown>(`/owner/races/${raceId}/odds`)) as Record< - string, - staleTime: 0, - }); -
Added / After Commit
+ diff --git a/src/routes/net-exposure-detail.tsx b/src/routes/net-exposure-detail.tsx + index da1c9d1..3505bc2 100644 + marketId: string, + parentUserId?: string, + ): Promise<DetailData> { + const res = (await tenantApiClient.post<unknown>("/horse-racing/reports/get_market_net_exposure", { + raceId, + marketId, + ...(parentUserId ? { parentUserId } : {}), + return (res?.data ?? res) as DetailData; + } + + async function fetchNetBets( + raceId: string, + marketId: string, + parentUserId?: string, + ): Promise<Bet[]> { + const res = await tenantApiClient.post<unknown>("/horse-racing/reports/get_net_bets", {
Removed / Before Commit
- diff --git a/src/routes/user-exposure-detail.tsx b/src/routes/user-exposure-detail.tsx - index 2450e90..fc701d4 100644 - marketId: string, - parentUserId?: string, - ): Promise<DetailData> { - const res = (await tenantApiClient.post<unknown>("/horse-racing/reports/net-exposure/detail", { - raceId, - marketId, - ...(parentUserId ? { parentUserId } : {}), - return (res?.data ?? res) as DetailData; - } - - async function fetchOdds(raceId: string): Promise<OddsMarket[]> { - const res = (await tenantApiClient.get<unknown>(`/owner/races/${raceId}/odds`)) as Record< - string, - staleTime: 0, - }); -
Added / After Commit
+ diff --git a/src/routes/user-exposure-detail.tsx b/src/routes/user-exposure-detail.tsx + index 2450e90..fc701d4 100644 + marketId: string, + parentUserId?: string, + ): Promise<DetailData> { + const res = (await tenantApiClient.post<unknown>("/horse-racing/reports/get_market_net_exposure", { + raceId, + marketId, + ...(parentUserId ? { parentUserId } : {}), + return (res?.data ?? res) as DetailData; + } + + async function fetchNetBets( + raceId: string, + marketId: string, + parentUserId?: string, + ): Promise<Bet[]> { + const res = await tenantApiClient.post<unknown>("/horse-racing/reports/get_net_bets", {
Removed / Before Commit
- diff --git a/src/services/api/resourceService.ts b/src/services/api/resourceService.ts - index 95582fc..a6b9b18 100644 - update: (id: string, payload: TUpdate) => Promise<TRecord>; - remove: (id: string) => Promise<void>; - } - - function toQueryString(params?: ListParams) { - if (!params) return ""; - const searchParams = new URLSearchParams();
Added / After Commit
+ diff --git a/src/services/api/resourceService.ts b/src/services/api/resourceService.ts + index 95582fc..a6b9b18 100644 + update: (id: string, payload: TUpdate) => Promise<TRecord>; + remove: (id: string) => Promise<void>; + } + + function toQueryString(params?: ListParams) { + if (!params) return ""; + const searchParams = new URLSearchParams();