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:
Claude 2025-11-23 07:28:52 +00:00
parent 8720a56c7d
commit dda92f5664
No known key found for this signature in database

View file

@ -411,14 +411,16 @@ export default function App() {
window.history.replaceState({}, '', newUrl) window.history.replaceState({}, '', newUrl)
} }
const onCloseEventDetail = () => { const handleDrawerOpenChange = (isOpen: boolean) => {
onOpenChange() onOpenChange()
// Remove eventid from URL // Remove eventid from URL when drawer is closed
const params = new URLSearchParams(window.location.search) if (!isOpen) {
params.delete('eventid') const params = new URLSearchParams(window.location.search)
const newUrl = `${window.location.pathname}?${params.toString()}` params.delete('eventid')
window.history.replaceState({}, '', newUrl) const newUrl = `${window.location.pathname}?${params.toString()}`
window.history.replaceState({}, '', newUrl)
}
} }
const MobileEventCard = ({ event }: { event: PublicEvent }) => ( const MobileEventCard = ({ event }: { event: PublicEvent }) => (
@ -617,8 +619,8 @@ export default function App() {
} }
} }
isOpen={isOpen} isOpen={isOpen}
onOpenChange={onOpenChange} onOpenChange={handleDrawerOpenChange}
onClose={onCloseEventDetail} onClose={() => handleDrawerOpenChange(false)}
onDelete={() => {}} onDelete={() => {}}
onEdit={() => {}} onEdit={() => {}}
> >