Fix drawer not closing when url change

pull/2573/head
Jérémy Rialland 2023-04-27 21:45:04 +02:00 committed by Jérémy Rialland
parent 55fcec82e6
commit 9696767018
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import FocusTrap from 'focus-trap-react'
import { ReactNode, useCallback, useEffect, useRef, useState } from 'react'
import ReactDOM from 'react-dom'
import { Trans } from 'react-i18next'
import { useLocation } from 'react-router-dom'
import styled, { css } from 'styled-components'
import { useOnClickOutside } from '@/hooks/useOnClickOutside'
@ -92,6 +93,12 @@ export const Drawer = ({
closeDrawer()
})
const location = useLocation()
useEffect(() => {
closeDrawer()
}, [closeDrawer, location])
return (
<>
{trigger({