agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

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

Open ChiragArora31 opened this issue 7 months ago • 5 comments

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.

ChiragArora31 avatar Apr 29 '26 01:04 ChiragArora31

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

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

greptile-apps avatar Apr 29 '26 01:04 greptile-apps

can be merged ig @ashish921998

ChiragArora31 avatar May 01 '26 14:05 ChiragArora31

@ashish921998 can we merge this?

ChiragArora31 avatar May 02 '26 16:05 ChiragArora31

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

ChiragArora31 avatar May 13 '26 00:05 ChiragArora31

@illegalcall can we get it merged

ChiragArora31 avatar Jun 08 '26 02:06 ChiragArora31

Closing as part of a backlog sweep: Agent Orchestrator was rewritten from the ground up (Go backend + Electron/React frontend), and this PR's changes target files from the pre-rewrite TypeScript codebase that no longer exist in the current tree, so it cannot be rebased onto main. If the underlying change still makes sense for the current app, please open a fresh PR against the new codebase. Thanks for the contribution!

harshitsinghbhandari avatar Jul 06 '26 17:07 harshitsinghbhandari