Skip to content

Commit 3de42ca

Browse files
committed
bring back navigation
1 parent eec71da commit 3de42ca

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/components/FrameworkSelect.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react'
22
import { create } from 'zustand'
3-
import { useLocation, useNavigate, useParams } from '@tanstack/react-router'
3+
import { useNavigate, useParams } from '@tanstack/react-router'
44
import { useQueryClient } from '@tanstack/react-query'
55
import { Select } from './Select'
66
import { Framework, getLibrary, LibraryId } from '~/libraries'
@@ -123,7 +123,6 @@ function useFrameworkConfig({ frameworks }: { frameworks: Framework[] }) {
123123
*/
124124
export function useCurrentFramework(frameworks: Framework[]) {
125125
const navigate = useNavigate()
126-
const location = useLocation()
127126
const userQuery = useCurrentUserQuery()
128127
const queryClient = useQueryClient()
129128

@@ -144,6 +143,9 @@ export function useCurrentFramework(frameworks: Framework[]) {
144143

145144
const setFramework = React.useCallback(
146145
(framework: string) => {
146+
navigate({
147+
params: { framework } as any,
148+
})
147149
// Always update localStorage as fallback
148150
localCurrentFramework.setCurrentFramework(framework)
149151
queryClient.setQueryData(currentUserQueryOptions.queryKey, (user) =>
@@ -155,7 +157,7 @@ export function useCurrentFramework(frameworks: Framework[]) {
155157
persistFrameworkToServer(framework)
156158
}
157159
},
158-
[localCurrentFramework, queryClient, userQuery.data],
160+
[localCurrentFramework, navigate, queryClient, userQuery.data],
159161
)
160162

161163
React.useEffect(() => {

0 commit comments

Comments
 (0)