Skip to content

fix(web): use client navigation for sidebar dashboard links#1550

Open
ChiragArora31 wants to merge 5 commits into
AgentWrapper:mainfrom
ChiragArora31:fix/1408-sidebar-dashboard-client-nav
Open

fix(web): use client navigation for sidebar dashboard links#1550
ChiragArora31 wants to merge 5 commits into
AgentWrapper:mainfrom
ChiragArora31:fix/1408-sidebar-dashboard-client-nav

Conversation

@ChiragArora31

Copy link
Copy Markdown
Contributor

Resolves #1408.

Summary

  • Routes project-row dashboard button clicks through the existing client navigation helper.
  • Preserves normal modified-click behavior for opening links in a new tab/window.
  • Adds a sidebar regression test for client navigation.

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.tsx
  • pnpm --filter @aoagents/ao-web... build
  • pnpm --filter @aoagents/ao-web test was also run; it still has existing unrelated failures in serialize.test.ts, page.test.tsx, api-routes.test.ts, and the tmux integration test when tmux is unavailable.

@greptile-apps

greptile-apps Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes client-side navigation for the per-row project dashboard button in the ProjectSidebar. Previously the button's onClick only called stopPropagation and onMobileClose without preventing default or invoking the navigate() helper, so ordinary clicks fell through to a full browser reload instead of a router transition.

  • Root fix: The dashboard Link's onClick now calls e.preventDefault() + navigate(projectHref) for plain clicks, preserving modifier-key (cmd/ctrl/shift) behavior to open in a new tab/window.
  • Dead-code removal: e.button === 1 guards removed from three existing onClick handlers — middle-click fires auxclick, not click, so these conditions were always false.
  • Regression test added: A new test verifies that a plain click on the dashboard button calls router.push with the correct project path.

Confidence Score: 5/5

Safe 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.

Important Files Changed

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
Loading

Reviews (2): Last reviewed commit: "fix(web): remove unreachable sidebar cli..." | Re-trigger Greptile

Comment thread packages/web/src/components/ProjectSidebar.tsx Outdated
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@ChiragArora31 ChiragArora31 changed the title Use client navigation for sidebar dashboard links fix(web): use client navigation for sidebar dashboard links Apr 29, 2026
@ChiragArora31

Copy link
Copy Markdown
Contributor Author

can be merged ig @ashish921998

@ChiragArora31

Copy link
Copy Markdown
Contributor Author

@ashish921998 can we merge this?

@ChiragArora31

Copy link
Copy Markdown
Contributor Author

Hi @illegalcall @ashish921998 since its approved, can me merge this?

ChiragArora31 and others added 3 commits May 17, 2026 04:55
Co-authored-by: Cursor <cursoragent@cursor.com>
…-1550

# Conflicts:
#	packages/web/src/components/ProjectSidebar.tsx
@ChiragArora31

Copy link
Copy Markdown
Contributor Author

@illegalcall can we get it merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard button in sidebar causes full page reload on every click

2 participants