diff --git a/components/shell/CommandPalette/Root.tsx b/components/shell/CommandPalette/Root.tsx index c7d0898..e6d3c56 100644 --- a/components/shell/CommandPalette/Root.tsx +++ b/components/shell/CommandPalette/Root.tsx @@ -46,9 +46,7 @@ export const CommandPaletteRoot = ({ children: React.ReactNode }) => { const router = useRouter() - const pathname = usePathname() - const searchParams = useSearchParams() - const staticActions = getStaticActions({ router, pathname, searchParams }) + const staticActions = getStaticActions({ router }) return ( diff --git a/components/shell/CommandPalette/actions.ts b/components/shell/CommandPalette/actions.ts index 36bed9c..5f112ba 100644 --- a/components/shell/CommandPalette/actions.ts +++ b/components/shell/CommandPalette/actions.ts @@ -1,15 +1,6 @@ import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime' -import { ReadonlyURLSearchParams } from 'next/navigation' -export const getStaticActions = ({ - router, - pathname, - searchParams, -}: { - router: AppRouterInstance - pathname: string - searchParams: ReadonlyURLSearchParams -}) => [ +export const getStaticActions = ({ router }: { router: AppRouterInstance }) => [ { id: 'quick-action-modal', name: 'Open Quick Action Panel', @@ -25,9 +16,10 @@ export const getStaticActions = ({ shortcut: ['w'], keywords: 'workspace,panel', perform: () => { - const newParams = new URLSearchParams(searchParams) + const pathname = window.location.pathname + const newParams = new URLSearchParams(window.location.search) newParams.set('workspaceOpen', 'true') - router.push((pathname ?? '') + '?' + newParams.toString()) + router.push(`${pathname}?${newParams.toString()}`) }, }, {