Skip to content

Commit 440419a

Browse files
committed
cleanup the useCurrentFramework
1 parent ac472b2 commit 440419a

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

src/components/DocsLayout.tsx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,6 @@ const useLocalCurrentFramework = create<{
5757
*/
5858
function useCurrentFramework(frameworks: Framework[]) {
5959
const navigate = useNavigate()
60-
const matches = useMatches()
61-
const lastMatch = last(matches)
62-
const { libraryId, version } = useParams({
63-
from: '/$libraryId/$version/docs',
64-
})
65-
6660
const { framework: paramsFramework } = useParams({
6761
strict: false,
6862
})
@@ -77,15 +71,6 @@ function useCurrentFramework(frameworks: Framework[]) {
7771

7872
const setFramework = React.useCallback(
7973
(framework: string) => {
80-
const currentPath = lastMatch.pathname
81-
const frameworkIndex = currentPath.indexOf('/framework/')
82-
83-
if (frameworkIndex === -1) {
84-
// If we're not on a framework path, just update the framework in localStorage
85-
localCurrentFramework.setCurrentFramework(framework)
86-
return
87-
}
88-
8974
navigate({
9075
to: '.',
9176
params: (prev) => ({
@@ -95,7 +80,7 @@ function useCurrentFramework(frameworks: Framework[]) {
9580
})
9681
localCurrentFramework.setCurrentFramework(framework)
9782
},
98-
[localCurrentFramework, navigate, libraryId, version, lastMatch.pathname]
83+
[localCurrentFramework, navigate]
9984
)
10085

10186
React.useEffect(() => {

0 commit comments

Comments
 (0)