Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Move everything in the hook

Terry Sutton7df3151384b8
diff --git a/packages/ui/src/components/Command/CommandMenu.tsx b/packages/ui/src/components/Command/CommandMenu.tsx
index ca2aba5bde3..3beb7a0fea6 100644
--- a/packages/ui/src/components/Command/CommandMenu.tsx
+++ b/packages/ui/src/components/Command/CommandMenu.tsx
@@ -118,12 +118,6 @@ const CommandMenu = () => {
)
}
- function handleSetPages(pages: string[], keepSearch?: boolean) {
- setPages(pages)
- if (!keepSearch) setSearch('')
- commandInputRef.current?.focus()
- }
-
const showCommandInput = !currentPage || !CHAT_ROUTES.includes(currentPage)
return (
@@ -153,7 +147,7 @@ const CommandMenu = () => {
<CommandItem
type="command"
onSelect={() => {
- handleSetPages([...pages, COMMAND_ROUTES.AI], true)
+ setPages([...pages, COMMAND_ROUTES.AI])
}}
forceMount
>
@@ -172,7 +166,7 @@ const CommandMenu = () => {
</CommandItem>
<CommandItem
type="command"
- onSelect={() => handleSetPages([...pages, COMMAND_ROUTES.DOCS_SEARCH], true)}
+ onSelect={() => setPages([...pages, COMMAND_ROUTES.DOCS_SEARCH])}
forceMount
>
<IconBook className="" />
@@ -225,10 +219,7 @@ const CommandMenu = () => {
</CommandGroup>
<CommandGroup heading="Settings">
- <CommandItem
- type="link"
- onSelect={() => handleSetPages([...pages, 'Theme'], false)}
- >
+ <CommandItem type="link" onSelect={() => setPages([...pages, 'Theme'])}>
<IconMonitor className="mr-2" />
Change theme
</CommandItem>
diff --git a/packages/ui/src/components/Command/sections/DashboardTableEditor.tsx b/packages/ui/src/components/Command/sections/DashboardTableEditor.tsx
index 48b560416f5..8b4a6a6fb99 100644
--- a/packages/ui/src/components/Command/sections/DashboardTableEditor.tsx
+++ b/packages/ui/src/components/Command/sections/DashboardTableEditor.tsx
@@ -9,6 +9,7 @@ export default function DashboardTableEditor() {
const router = useRouter()
const { setPages, currentPage, pages } = useCommandMenu()
console.log('currentPage', currentPage)
+ console.log('pages', pages)
return (
<CommandGroup heading={dashboardItems.tools.label}>