Showing AI reviews for super-admin
Project AI Score ?
72%
Quality Avg ?
77%
Security Avg ?
64%
Reviews ?
91

Review Result ?

solutionbowl/super-admin · 7a8ce02d
Adds a new way to handle navigation parameters using sessionStorage which keeps params out of URL but persistent within same tab navigation. The changes are well-structured and help avoid URL pollution. Minor risk exists with defaulting raceId and marketId to empty strings which might cause subtle bugs if callers do not check for validity. No apparent validation on the inputs to setExposureParams which could cause issues if malformed data is stored. No explicit error handling or logging during JSON parsing.
Quality ?
85%
Security ?
60%
Business Value ?
80%
Maintainability ?
83%
Issues & Suggested Fixes ?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Generic Catch Block Without Error Logging
Where src/lib/nav-params.ts:21
Issue / Evidence generic catch block without error logging
Suggested Fix add logging for JSON parsing errors to assist debugging
Getexposureparams Returns Empty Strings As...
Where src/lib/nav-params.ts:20
Issue / Evidence getExposureParams returns empty strings as defaults
Suggested Fix consider returning null or undefined to clearly indicate missing data
Missing Validation
Where src/lib/nav-params.ts:17
Issue / Evidence no input validation on params before JSON.stringify
Suggested Fix add validation to ensure required fields raceId and marketId are non-empty strings to reduce risk of invalid state
Use Of Sessionstorage Directly
Where src/lib/nav-params.ts:16
Issue / Evidence use of sessionStorage directly
Suggested Fix consider adding feature detection or fallback for environments without sessionStorage support
Vague And Non Descriptive
Where commit message
Issue / Evidence vague and non-descriptive
Suggested Fix improve commit message to describe what 'url changes in net-exposure' involved for better traceability
Code Change Preview · src/lib/nav-params.ts ?
Removed / Before Commit
- diff --git a/src/lib/nav-params.ts b/src/lib/nav-params.ts
- new file mode 100644
- index 0000000..5d8440a
Added / After Commit
+ diff --git a/src/lib/nav-params.ts b/src/lib/nav-params.ts
+ new file mode 100644
+ index 0000000..5d8440a
+ /**
+  * nav-params.ts
+  * URL-clean navigation params — stored in sessionStorage so they
+  * never appear in the address bar but survive same-tab navigation.
+  */
+ 
+ export interface ExposureNavParams {
+   raceId: string;
+   marketId: string;
+   userId?: string;
+   parentUserId?: string;
+ }
+ 
+ const KEY = "exposure_nav_params";
+ 
Removed / Before Commit
- diff --git a/src/routes/net-exposure-bet.tsx b/src/routes/net-exposure-bet.tsx
- index 5ed613b..4c58b31 100644
- import { cn } from "@/lib/utils";
- import { tenantApiClient } from "@/services/api/apiClient";
- import { format } from "date-fns";
- 
- export const Route = createFileRoute("/net-exposure-bet")({
- component: NetExposureBetPage,
-   validateSearch: (s: Record<string, unknown>) => ({
-     raceId: String(s.raceId ?? ""),
-     marketId: String(s.marketId ?? ""),
-     userId: String(s.userId ?? ""),
-   }),
- head: () => ({ meta: [{ title: "Net Exposure Bets - B2B-B2C Panel" }] }),
- });
- 
- // ─── Page ─────────────────────────────────────────────────────────────────────
- 
Added / After Commit
+ diff --git a/src/routes/net-exposure-bet.tsx b/src/routes/net-exposure-bet.tsx
+ index 5ed613b..4c58b31 100644
+ import { cn } from "@/lib/utils";
+ import { tenantApiClient } from "@/services/api/apiClient";
+ import { format } from "date-fns";
+ import { getExposureParams } from "@/lib/nav-params";
+ 
+ export const Route = createFileRoute("/net-exposure-bet")({
+ component: NetExposureBetPage,
+ head: () => ({ meta: [{ title: "Net Exposure Bets - B2B-B2C Panel" }] }),
+ });
+ 
+ // ─── Page ─────────────────────────────────────────────────────────────────────
+ 
+ function NetExposureBetPage() {
+   const { raceId, marketId, userId } = getExposureParams();
+ const navigate = useNavigate();
+ 
Removed / Before Commit
- diff --git a/src/routes/net-exposure-detail.tsx b/src/routes/net-exposure-detail.tsx
- index 829e52e..f81274a 100644
- import { Button } from "@/components/ui/button";
- import { cn } from "@/lib/utils";
- import { tenantApiClient } from "@/services/api/apiClient";
- 
- export const Route = createFileRoute("/net-exposure-detail")({
- component: NetExposureDetailPage,
-   validateSearch: (s: Record<string, unknown>) => ({
-     raceId: String(s.raceId ?? ""),
-     marketId: String(s.marketId ?? ""),
-     parentUserId: String(s.parentUserId ?? ""),
-   }),
- head: () => ({ meta: [{ title: "Net Exposure Detail - B2B-B2C Panel" }] }),
- });
- 
- // ─── Page ─────────────────────────────────────────────────────────────────────
- 
Added / After Commit
+ diff --git a/src/routes/net-exposure-detail.tsx b/src/routes/net-exposure-detail.tsx
+ index 829e52e..f81274a 100644
+ import { Button } from "@/components/ui/button";
+ import { cn } from "@/lib/utils";
+ import { tenantApiClient } from "@/services/api/apiClient";
+ import { getExposureParams } from "@/lib/nav-params";
+ 
+ export const Route = createFileRoute("/net-exposure-detail")({
+ component: NetExposureDetailPage,
+ head: () => ({ meta: [{ title: "Net Exposure Detail - B2B-B2C Panel" }] }),
+ });
+ 
+ // ─── Page ─────────────────────────────────────────────────────────────────────
+ 
+ function NetExposureDetailPage() {
+   const { raceId, marketId, parentUserId } = getExposureParams();
+ const navigate = useNavigate();
+ 
Removed / Before Commit
- diff --git a/src/routes/net-exposure-herarchy.tsx b/src/routes/net-exposure-herarchy.tsx
- index 8439b74..bc7e760 100644
- import { useQuery } from "@tanstack/react-query";
- import { useState } from "react";
- import type React from "react";
- import { ChevronDown, ChevronUp, Network, RefreshCw, ArrowLeft } from "lucide-react";
- import { tenantApiClient } from "@/services/api/apiClient";
- import { Button } from "@/components/ui/button";
- import { cn } from "@/lib/utils";
- 
- export const Route = createFileRoute("/net-exposure-herarchy")({
- component: NetExposureHierarchyPage,
-   validateSearch: (search: Record<string, unknown>) => ({
-     raceId: String(search.raceId ?? ""),
-     marketId: String(search.marketId ?? ""),
-     userId: String(search.userId ?? ""),
-   }),
- head: () => ({ meta: [{ title: "Net Exposure Hierarchy - B2B-B2C Panel" }] }),
Added / After Commit
+ diff --git a/src/routes/net-exposure-herarchy.tsx b/src/routes/net-exposure-herarchy.tsx
+ index 8439b74..bc7e760 100644
+ import { useQuery } from "@tanstack/react-query";
+ import { useState } from "react";
+ import type React from "react";
+ import { ChevronDown, Network, RefreshCw, ArrowLeft } from "lucide-react";
+ import { tenantApiClient } from "@/services/api/apiClient";
+ import { Button } from "@/components/ui/button";
+ import { cn } from "@/lib/utils";
+ import { getExposureParams } from "@/lib/nav-params";
+ 
+ export const Route = createFileRoute("/net-exposure-herarchy")({
+ component: NetExposureHierarchyPage,
+ head: () => ({ meta: [{ title: "Net Exposure Hierarchy - B2B-B2C Panel" }] }),
+ });
+ 
+ }
+ 
Removed / Before Commit
- diff --git a/src/routes/net-exposure.tsx b/src/routes/net-exposure.tsx
- index c6b8777..9460c7a 100644
- import { Gauge, List, Users } from "lucide-react";
- import { useAutoRefresh } from "@/hooks/useAutoRefresh";
- import { internalServices } from "@/services/api/internalServices";
- 
- export const Route = createFileRoute("/net-exposure")({
- component: NetExposurePage,
- type="button"
- title="View detail"
- className="rounded p-0.5 hover:bg-muted transition-colors"
-                             onClick={() =>
-                             navigate({
-                             to: "/net-exposure-detail",
-                             search: {
-                             raceId: race.raceId,
-                            marketId: market.marketId,
-                            },
Added / After Commit
+ diff --git a/src/routes/net-exposure.tsx b/src/routes/net-exposure.tsx
+ index c6b8777..9460c7a 100644
+ import { Gauge, List, Users } from "lucide-react";
+ import { useAutoRefresh } from "@/hooks/useAutoRefresh";
+ import { internalServices } from "@/services/api/internalServices";
+ import { setExposureParams } from "@/lib/nav-params";
+ 
+ export const Route = createFileRoute("/net-exposure")({
+ component: NetExposurePage,
+ type="button"
+ title="View detail"
+ className="rounded p-0.5 hover:bg-muted transition-colors"
+                             onClick={() => {
+                               setExposureParams({ raceId: race.raceId, marketId: market.marketId });
+                               navigate({ to: "/net-exposure-detail" });
+                             }}
+ >
+ <Gauge className="h-3.5 w-3.5 text-muted-foreground hover:text-primary" />
Removed / Before Commit
- diff --git a/src/routes/user-details.$userId.tsx b/src/routes/user-details.$userId.tsx
- index 97befdf..91a528c 100644
- import { tenantApiClient } from "@/services/api/apiClient";
- import { cn } from "@/lib/utils";
- import { format } from "date-fns";
- 
- export const Route = createFileRoute("/user-details/$userId")({
- component: UserDetailsPage,
- type="button"
- title="View detail"
- className="rounded p-0.5 hover:bg-muted transition-colors"
-                             onClick={() =>
-                             navigate({
-                             to: "/net-exposure-detail",
-                             search: {
-                            raceId: race.raceId,
-                            marketId: market.marketId,
-                            parentUserId: userId,
Added / After Commit
+ diff --git a/src/routes/user-details.$userId.tsx b/src/routes/user-details.$userId.tsx
+ index 97befdf..91a528c 100644
+ import { tenantApiClient } from "@/services/api/apiClient";
+ import { cn } from "@/lib/utils";
+ import { format } from "date-fns";
+ import { setExposureParams } from "@/lib/nav-params";
+ 
+ export const Route = createFileRoute("/user-details/$userId")({
+ component: UserDetailsPage,
+ type="button"
+ title="View detail"
+ className="rounded p-0.5 hover:bg-muted transition-colors"
+                             onClick={() => {
+                               setExposureParams({ raceId: race.raceId, marketId: market.marketId, parentUserId: userId });
+                               navigate({ to: "/net-exposure-detail" });
+                             }}
+ >
+ <Gauge className="h-3.5 w-3.5 text-muted-foreground hover:text-primary" />