fix(console-ui): make sidebar navigation native#458
Conversation
Avoid the broken Next Link client-router path for shell navigation so sidebar clicks always fall back to browser-native route loads.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No security-relevant changes detected — this PR modifies only No trust boundaries are touched by this diff. A sidebar component that handles navigation state, display logic, or styling does not introduce new attack surface unless it meets one of the following conditions (none of which are visible without seeing the actual diff):
If the diff does any of the above, re-run this review with the full file content. Otherwise no threat model update is needed. 🔐 Threat model: |
ethenotethan
left a comment
There was a problem hiding this comment.
Automated Code Review — Layr-Labs/d-inference#
Verdict: REQUEST_CHANGES
Security — ✅ No issues found
Performance — 1 finding(s) (1 blocking)
- 🟡 [MEDIUM]
console-ui/src/components/Sidebar.tsx:44-46— Window width check repeated on every mobile click instead of using media query or cached value- Suggestion: Use CSS media queries for responsive behavior or cache window.innerWidth check with resize listener to avoid repeated DOM queries
Type_diligence — ✅ No issues found
Additive_complexity — 1 finding(s)
- 🔵 [INFO]
console-ui/src/components/Sidebar.tsx:22— useRouter import is no longer used after removing Next.js Link components- Suggestion: Remove unused useRouter import from next/navigation
2 finding(s) total, 1 blocking. Verdict: REQUEST_CHANGES.
🤖 Automated review by Centaur · DAR-186
| const closeSidebarOnMobile = () => { | ||
| if (window.innerWidth < 640) setSidebarOpen(false); | ||
| }; |
There was a problem hiding this comment.
🟡 [MEDIUM] ⚡ Window width check repeated on every mobile click instead of using media query or cached value
💡 Suggestion: Use CSS media queries for responsive behavior or cache window.innerWidth check with resize listener to avoid repeated DOM queries
📊 Score: 2×4 = 8 · Category: Repeated work
| @@ -19,7 +20,6 @@ import { | |||
| Sun, | |||
| Moon, | |||
| } from "lucide-react"; | |||
There was a problem hiding this comment.
🔵 [INFO] 🧩 useRouter import is no longer used after removing Next.js Link components
💡 Suggestion: Remove unused useRouter import from next/navigation
📊 Score: 2×3 = 6 · Category: dead code
Summary
next/linkfor sidebar shell navigation with native anchors so clicks are no longer captured by the broken client-router path.Before
flowchart LR subgraph Behavior_Before[Behavior] U1[User clicks Stats in sidebar] --> L1[Next Link delegated click handler] L1 --> P1[preventDefault on anchor] P1 --> R1[Client router does not push/fetch] R1 --> S1[URL stays on current route] end subgraph Code_Before[Code] C1[Sidebar nav item] --> C2[next/link Link] C2 --> C3[Next app-router client navigation] endAfter
flowchart LR subgraph Behavior_After[Behavior] U2[User clicks Stats in sidebar] --> A1[Native anchor href=/stats] A1 --> B1[Browser performs route load] B1 --> S2[/stats renders and Stats is active] end subgraph Code_After[Code] C4[Sidebar nav item] --> C5[plain a href] C5 --> C6[closeSidebarOnMobile only] C6 --> C7[Browser-native navigation] endTest plan
npm run buildpassed from the fix worktree. Because disk was full, validation used the existing dependency tree with a temporary Turbopack root override that was removed before commit.npx eslint src/passed with 0 errors; existing repo warnings remain.http://localhost:3017: clicking the actual Stats sidebar link changedlocation.pathnameto/statsand made Stats active.Made with Cursor
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.