Core: Fix usePathname() adapter for Tanstack Start

This commit is contained in:
Fuma Nama
2025-11-15 18:02:28 +08:00
parent fd80ccfdb4
commit c5c00e980a
2 changed files with 7 additions and 7 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-core': patch
---
Fix `usePathname()` adapter for Tanstack Start
+2 -7
View File
@@ -1,11 +1,6 @@
import { type ReactNode, useMemo } from 'react';
import { type Framework, FrameworkProvider } from '@/framework/index';
import {
useParams,
Link,
useRouter,
useLocation,
} from '@tanstack/react-router';
import { useParams, Link, useRouter, useMatch } from '@tanstack/react-router';
const framework: Framework = {
Link({ href, prefetch, ...props }) {
@@ -16,7 +11,7 @@ const framework: Framework = {
);
},
usePathname() {
return useLocation().pathname;
return useMatch({ strict: false, select: (s) => s.pathname });
},
useRouter() {
const router = useRouter();