fix(web): use client navigation for sidebar dashboard links#1550
fix(web): use client navigation for sidebar dashboard links#1550ChiragArora31 wants to merge 5 commits into
Conversation
Greptile SummaryThis PR fixes client-side navigation for the per-row project dashboard button in the
Confidence Score: 5/5Safe to merge — the change is a minimal, targeted fix to a single click handler, backed by a new regression test. The dashboard button previously skipped client navigation entirely; the fix is straightforward (add preventDefault + call the existing navigate helper) and doesn't touch shared state or routing logic. Modifier-key open-in-new-tab behavior is correctly preserved. No parent click handlers exist on the containing divs, so removing stopPropagation from the early-return branch has no side effects. No files require special attention.
|
| Filename | Overview |
|---|---|
| packages/web/src/components/ProjectSidebar.tsx | Dashboard button onClick refactored to call navigate() for client-side routing; e.button===1 dead-code removed from three handlers; stopPropagation preserved for plain clicks. |
| packages/web/src/components/tests/ProjectSidebar.test.tsx | New test verifies that clicking the per-row dashboard button invokes router.push with the correct project path. |
Sequence Diagram
sequenceDiagram
participant User
participant DashboardLink
participant ClickHandler
participant Navigate
participant Router
participant MobileClose
User->>DashboardLink: plain click
DashboardLink->>ClickHandler: onClick(e)
ClickHandler->>ClickHandler: e.preventDefault()
ClickHandler->>ClickHandler: e.stopPropagation()
ClickHandler->>Navigate: navigate(projectHref)
Navigate->>Router: router.push(url)
Navigate->>MobileClose: onMobileClose?.()
User->>DashboardLink: cmd/ctrl/shift + click
DashboardLink->>ClickHandler: onClick(e)
ClickHandler->>ClickHandler: modifier detected → return early
Note over DashboardLink: browser opens in new tab/window
Reviews (2): Last reviewed commit: "fix(web): remove unreachable sidebar cli..." | Re-trigger Greptile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
can be merged ig @ashish921998 |
|
@ashish921998 can we merge this? |
|
Hi @illegalcall @ashish921998 since its approved, can me merge this? |
…shboard-client-nav
Co-authored-by: Cursor <cursoragent@cursor.com>
…-1550 # Conflicts: # packages/web/src/components/ProjectSidebar.tsx
|
@illegalcall can we get it merged |
Resolves #1408.
Summary
Root cause
The per-row dashboard action rendered a
Link, but its click handler only stopped propagation and allowed the default navigation path, which could trigger a full reload instead of the dashboard client transition.Approach
Prevent default only for ordinary clicks, then call the sidebar
navigate()helper so router navigation and mobile-close behavior stay consistent with the rest of the sidebar.Verification
pnpm --filter @aoagents/ao-web test -- ProjectSidebar.test.tsxpnpm --filter @aoagents/ao-web... buildpnpm --filter @aoagents/ao-web testwas also run; it still has existing unrelated failures inserialize.test.ts,page.test.tsx,api-routes.test.ts, and the tmux integration test whentmuxis unavailable.