fix: 🐛
This commit is contained in:
@@ -168,18 +168,18 @@ const SearchBar = forwardRef<
|
||||
}, [input, debouncedInput, profiles])
|
||||
|
||||
useEffect(() => {
|
||||
if (list) {
|
||||
setDisplayList(searching && !!input)
|
||||
}, [searching, input])
|
||||
|
||||
useEffect(() => {
|
||||
if (displayList && list) {
|
||||
modalManager.register(id, () => {
|
||||
setDisplayList(false)
|
||||
})
|
||||
} else {
|
||||
modalManager.unregister(id)
|
||||
}
|
||||
}, [list])
|
||||
|
||||
useEffect(() => {
|
||||
setDisplayList(searching && !!input)
|
||||
}, [searching, input])
|
||||
}, [displayList, list])
|
||||
|
||||
const handleKeyDown = useCallback(
|
||||
(e: React.KeyboardEvent) => {
|
||||
|
||||
@@ -11,6 +11,12 @@ class ModalManagerService {
|
||||
}
|
||||
|
||||
register(id: string, cb: () => void) {
|
||||
const modal = this.modals.find((m) => m.id === id)
|
||||
if (modal) {
|
||||
// already registered, update callback
|
||||
modal.cb = cb
|
||||
return
|
||||
}
|
||||
this.modals.push({ id, cb })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user