mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
fix(cmdk): empty state shows up when it shouldn't (#29272)
* fix(cmdk): empty state shows up when it shouldn't Can't remember why on earth I put this in a useMemo instead of a useEffect... * fix(command menu): switch branch command not showing up
This commit is contained in:
1 parent
8191842276
commit
f6768edde7
2 files changed
+5
-10
No files matched your search
@@ -17,7 +17,7 @@ export function useBranchCommands() {
|
||||
|
||||
let { data: branches } = useBranchesQuery(
|
||||
{
|
||||
projectRef: selectedProject?.ref,
|
||||
projectRef: selectedProject?.parentRef,
|
||||
},
|
||||
{ enabled: isBranchingEnabled }
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { type PropsWithChildren, type RefObject, useMemo, useState } from 'react'
|
||||
import { type PropsWithChildren, type RefObject, useEffect, useState } from 'react'
|
||||
|
||||
import { cn } from 'ui'
|
||||
|
||||
@@ -24,14 +24,9 @@ const CommandEmpty = ({
|
||||
const query = useQuery()
|
||||
|
||||
const [render, setRender] = useState(false)
|
||||
useMemo(() => {
|
||||
if (!query) setRender(false)
|
||||
/**
|
||||
* In a timeout so the DOM update happens before we query.
|
||||
*/
|
||||
setTimeout(() => {
|
||||
setRender(!listRef?.current?.querySelector('[cmdk-item]'))
|
||||
})
|
||||
useEffect(() => {
|
||||
if (!query) return setRender(false)
|
||||
setRender(!listRef?.current?.querySelector('[cmdk-item]'))
|
||||
}, [query])
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user