mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-23 16:13:04 +00:00
Simplify: clear de busca só no overlay (open=false)
Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
This commit is contained in:
parent
8d30667c2a
commit
e7d9ca22df
1 changed files with 4 additions and 11 deletions
|
|
@ -3,7 +3,6 @@
|
||||||
import { usePathname } from 'next/navigation'
|
import { usePathname } from 'next/navigation'
|
||||||
import { useCallback, useEffect, useState, type ReactNode } from 'react'
|
import { useCallback, useEffect, useState, type ReactNode } from 'react'
|
||||||
|
|
||||||
import { useHomeSearch } from '@/components/campaign/dashboard/HomeSearchContext'
|
|
||||||
import { useCampaignQuickActionContext } from '@/components/campaign/shell/CampaignQuickActionContext'
|
import { useCampaignQuickActionContext } from '@/components/campaign/shell/CampaignQuickActionContext'
|
||||||
import { CampaignQuickActionsFab } from '@/components/campaign/shell/CampaignQuickActionsFab'
|
import { CampaignQuickActionsFab } from '@/components/campaign/shell/CampaignQuickActionsFab'
|
||||||
import { CampaignQuickActionsOverlay } from '@/components/campaign/shell/CampaignQuickActionsOverlay'
|
import { CampaignQuickActionsOverlay } from '@/components/campaign/shell/CampaignQuickActionsOverlay'
|
||||||
|
|
@ -24,22 +23,16 @@ export const CampaignQuickActionsHost = ({ role }: { role: CampaignRole }) => {
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const { context } = useCampaignQuickActionContext()
|
const { context } = useCampaignQuickActionContext()
|
||||||
const { clear } = useHomeSearch()
|
|
||||||
|
|
||||||
const mounted = shouldMountQuickActionsFab(pathname, role)
|
const mounted = shouldMountQuickActionsFab(pathname, role)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setOpen(false)
|
setOpen(false)
|
||||||
clear()
|
}, [pathname])
|
||||||
}, [pathname, clear])
|
|
||||||
|
|
||||||
const handleOpenChange = useCallback(
|
const handleOpenChange = useCallback((next: boolean) => {
|
||||||
(next: boolean) => {
|
setOpen(next)
|
||||||
setOpen(next)
|
}, [])
|
||||||
if (!next) clear()
|
|
||||||
},
|
|
||||||
[clear],
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!mounted) return null
|
if (!mounted) return null
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue