Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

forward hash fragment in ForwardSearch back-compat redirect\n\n`/skills#section-mcp` was silently dropping the fragment before reaching\n`/connections`. Destructure `hash` from `useLocation()` and append it to\nthe Navigate target alongside `search`. Test added for the hash case.\n

shanu27e6469af017
diff --git a/app/src/AppRoutes.skills.test.tsx b/app/src/AppRoutes.skills.test.tsx
index 9e737ca7d3..abf982e6ed 100644
--- a/app/src/AppRoutes.skills.test.tsx
+++ b/app/src/AppRoutes.skills.test.tsx
@@ -42,10 +42,10 @@ vi.mock('./pages/WorkflowsRun', () => ({ default: () => <div /> }));
function LocationSpy({
onCapture,
}: {
- onCapture: (loc: { pathname: string; search: string }) => void;
+ onCapture: (loc: { pathname: string; search: string; hash: string }) => void;
}) {
- const { pathname, search } = useLocation();
- onCapture({ pathname, search });
+ const { pathname, search, hash } = useLocation();
+ onCapture({ pathname, search, hash });
return null;
}
@@ -64,7 +64,7 @@ describe('/skills back-compat redirect', () => {
it('forwards ?tab= query params from /skills to /connections', () => {
// Object.assign so the last render-pass wins (initial /skills is overwritten
// by the settled /connections after Navigate fires via useLayoutEffect).
- const loc = { pathname: '', search: '' };
+ const loc = { pathname: '', search: '', hash: '' };
render(
<MemoryRouter initialEntries={['/skills?tab=mcp']}>
<AppRoutes />
@@ -75,8 +75,20 @@ describe('/skills back-compat redirect', () => {
expect(loc.search).toBe('?tab=mcp');
});
+ it('forwards a hash fragment from /skills to /connections', () => {
+ const loc = { pathname: '', search: '', hash: '' };
+ render(
+ <MemoryRouter initialEntries={['/skills#section-mcp']}>
+ <AppRoutes />
+ <LocationSpy onCapture={l => Object.assign(loc, l)} />
+ </MemoryRouter>
+ );
+ expect(loc.pathname).toBe('/connections');
+ expect(loc.hash).toBe('#section-mcp');
+ });
+
it('produces an empty search when /skills has no query string', () => {
- const loc = { pathname: '', search: '(init)' };
+ const loc = { pathname: '', search: '(init)', hash: '' };
render(
<MemoryRouter initialEntries={['/skills']}>
<AppRoutes />
diff --git a/app/src/AppRoutes.tsx b/app/src/AppRoutes.tsx
index 28e74b6c88..5160284a21 100644
--- a/app/src/AppRoutes.tsx
+++ b/app/src/AppRoutes.tsx
@@ -26,8 +26,8 @@ import Welcome from './pages/Welcome';
import WorkflowsRun from './pages/WorkflowsRun';
function ForwardSearch({ to }: { to: string }) {
- const { search } = useLocation();
- return <Navigate to={`${to}${search}`} replace />;
+ const { search, hash } = useLocation();
+ return <Navigate to={`${to}${search}${hash}`} replace />;
}
interface AppRoutesProps {