mirror of
https://github.com/m1ngsama/FUJI.git
synced 2025-12-24 10:51:27 +00:00
fix: ensure eventid is removed from URL when drawer closes
- Replace onCloseEventDetail with handleDrawerOpenChange - Handle all drawer close scenarios: button click, outside click, ESC key - Remove eventid from URL whenever drawer is closed via any method - Fixes issue where eventid remained in URL after closing drawer
This commit is contained in:
parent
8720a56c7d
commit
dda92f5664
1 changed files with 10 additions and 8 deletions
|
|
@ -411,14 +411,16 @@ export default function App() {
|
|||
window.history.replaceState({}, '', newUrl)
|
||||
}
|
||||
|
||||
const onCloseEventDetail = () => {
|
||||
const handleDrawerOpenChange = (isOpen: boolean) => {
|
||||
onOpenChange()
|
||||
|
||||
// Remove eventid from URL
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
params.delete('eventid')
|
||||
const newUrl = `${window.location.pathname}?${params.toString()}`
|
||||
window.history.replaceState({}, '', newUrl)
|
||||
// Remove eventid from URL when drawer is closed
|
||||
if (!isOpen) {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
params.delete('eventid')
|
||||
const newUrl = `${window.location.pathname}?${params.toString()}`
|
||||
window.history.replaceState({}, '', newUrl)
|
||||
}
|
||||
}
|
||||
|
||||
const MobileEventCard = ({ event }: { event: PublicEvent }) => (
|
||||
|
|
@ -617,8 +619,8 @@ export default function App() {
|
|||
}
|
||||
}
|
||||
isOpen={isOpen}
|
||||
onOpenChange={onOpenChange}
|
||||
onClose={onCloseEventDetail}
|
||||
onOpenChange={handleDrawerOpenChange}
|
||||
onClose={() => handleDrawerOpenChange(false)}
|
||||
onDelete={() => {}}
|
||||
onEdit={() => {}}
|
||||
>
|
||||
|
|
|
|||
Loading…
Reference in a new issue