pull/1480/head^2
Jamie Pine 2022-01-12 04:34:50 -08:00 committed by GitHub
parent 70683a89b9
commit d2b9e67424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 13 deletions

View File

@ -81,18 +81,21 @@ export default function CreateEventTypeButton(props: Props) {
// inject selection data into url for correct router history // inject selection data into url for correct router history
const openModal = (option: EventTypeParent) => { const openModal = (option: EventTypeParent) => {
router.push({ // setTimeout fixes a bug where the url query params are removed immediately after opening the modal
pathname: router.pathname, setTimeout(() => {
query: { router.push({
...router.query, pathname: router.pathname,
new: "1", query: {
eventPage: option.slug, ...router.query,
...(option.teamId new: "1",
? { eventPage: option.slug,
teamId: option.teamId, ...(option.teamId
} ? {
: {}), teamId: option.teamId,
}, }
: {}),
},
});
}); });
}; };
@ -108,7 +111,6 @@ export default function CreateEventTypeButton(props: Props) {
<Dialog <Dialog
open={modalOpen.isOn} open={modalOpen.isOn}
onOpenChange={(isOpen) => { onOpenChange={(isOpen) => {
router.push(isOpen ? modalOpen.hrefOn : modalOpen.hrefOff);
if (!isOpen) closeModal(); if (!isOpen) closeModal();
}}> }}>
{!hasTeams || props.isIndividualTeam ? ( {!hasTeams || props.isIndividualTeam ? (