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)
}
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={() => {}}
>