From 0f8a3d6ae1d960bd27aa7762def59ff55e49a10f Mon Sep 17 00:00:00 2001 From: Rishabh Date: Tue, 14 Apr 2026 12:15:07 +0530 Subject: [PATCH 1/4] fix: resolve 404 on homepage during client-side navigation Nitro's [...slug] catch-all doesn't match empty path /api/page/. Re-export the catch-all handler as index.ts so the homepage API route works for both index.md and README.md variants. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/chronicle/src/server/api/page/index.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/chronicle/src/server/api/page/index.ts diff --git a/packages/chronicle/src/server/api/page/index.ts b/packages/chronicle/src/server/api/page/index.ts new file mode 100644 index 00000000..347ef5d4 --- /dev/null +++ b/packages/chronicle/src/server/api/page/index.ts @@ -0,0 +1 @@ +export { default } from './[...slug]'; From a2660b1102f0988b36162bd56add29c1770813ce Mon Sep 17 00:00:00 2001 From: Rishabh Date: Tue, 14 Apr 2026 13:32:11 +0530 Subject: [PATCH 2/4] fix: sync breadcrumbs with content during client-side navigation Use page.slug from context instead of route slug so breadcrumbs and content update together when the fetch completes, avoiding flicker. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/chronicle/src/pages/DocsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/chronicle/src/pages/DocsPage.tsx b/packages/chronicle/src/pages/DocsPage.tsx index 94a0206f..3ebb7928 100644 --- a/packages/chronicle/src/pages/DocsPage.tsx +++ b/packages/chronicle/src/pages/DocsPage.tsx @@ -30,7 +30,7 @@ export function DocsPage({ slug }: DocsPageProps) { /> Date: Tue, 14 Apr 2026 13:38:05 +0530 Subject: [PATCH 3/4] fix: use ApsaraLink for all mdx links for consistent styling Local links now use ApsaraLink with onClick + useNavigate instead of RouterLink, ensuring consistent styling across internal and external links. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../chronicle/src/components/mdx/link.tsx | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/chronicle/src/components/mdx/link.tsx b/packages/chronicle/src/components/mdx/link.tsx index 18f30d6f..b104e360 100644 --- a/packages/chronicle/src/components/mdx/link.tsx +++ b/packages/chronicle/src/components/mdx/link.tsx @@ -1,10 +1,12 @@ import { Link as ApsaraLink } from '@raystack/apsara'; -import type { ComponentProps } from 'react'; -import { Link as RouterLink } from 'react-router'; +import type { ComponentProps, MouseEvent } from 'react'; +import { useNavigate } from 'react-router'; type LinkProps = ComponentProps<'a'>; export function Link({ href, children, ...props }: LinkProps) { + const navigate = useNavigate(); + if (!href) { return {children}; } @@ -12,14 +14,6 @@ export function Link({ href, children, ...props }: LinkProps) { const isExternal = href.startsWith('http://') || href.startsWith('https://'); const isAnchor = href.startsWith('#'); - if (isAnchor) { - return ( - - {children} - - ); - } - if (isExternal) { return ( + {children} + + ); + } + + const onClick = (e: MouseEvent) => { + e.preventDefault(); + navigate(href); + }; + return ( - + {children} - + ); } From 27531cb9d6c4d3097d508f0650065bc71792693f Mon Sep 17 00:00:00 2001 From: Rishabh Date: Tue, 14 Apr 2026 14:05:33 +0530 Subject: [PATCH 4/4] fix: respect modifier keys and caller handlers in mdx link onClick Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/chronicle/src/components/mdx/link.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/chronicle/src/components/mdx/link.tsx b/packages/chronicle/src/components/mdx/link.tsx index b104e360..73cccc47 100644 --- a/packages/chronicle/src/components/mdx/link.tsx +++ b/packages/chronicle/src/components/mdx/link.tsx @@ -4,7 +4,7 @@ import { useNavigate } from 'react-router'; type LinkProps = ComponentProps<'a'>; -export function Link({ href, children, ...props }: LinkProps) { +export function Link({ href, children, onClick: onClickProp, ...props }: LinkProps) { const navigate = useNavigate(); if (!href) { @@ -36,12 +36,26 @@ export function Link({ href, children, ...props }: LinkProps) { } const onClick = (e: MouseEvent) => { + if ( + e.defaultPrevented || + e.button !== 0 || + e.metaKey || + e.ctrlKey || + e.shiftKey || + e.altKey + ) { + return; + } + + onClickProp?.(e); + if (e.defaultPrevented) return; + e.preventDefault(); navigate(href); }; return ( - + {children} );