From d2b9e674244b990d1579d45b63ca6985d9940147 Mon Sep 17 00:00:00 2001 From: Jamie Pine <32987599+jamiepine@users.noreply.github.com> Date: Wed, 12 Jan 2022 04:34:50 -0800 Subject: [PATCH] fix (#1482) --- components/eventtype/CreateEventType.tsx | 28 +++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/components/eventtype/CreateEventType.tsx b/components/eventtype/CreateEventType.tsx index 002231aac0..22367c60e3 100644 --- a/components/eventtype/CreateEventType.tsx +++ b/components/eventtype/CreateEventType.tsx @@ -81,18 +81,21 @@ export default function CreateEventTypeButton(props: Props) { // inject selection data into url for correct router history const openModal = (option: EventTypeParent) => { - router.push({ - pathname: router.pathname, - query: { - ...router.query, - new: "1", - eventPage: option.slug, - ...(option.teamId - ? { - teamId: option.teamId, - } - : {}), - }, + // setTimeout fixes a bug where the url query params are removed immediately after opening the modal + setTimeout(() => { + router.push({ + pathname: router.pathname, + query: { + ...router.query, + new: "1", + eventPage: option.slug, + ...(option.teamId + ? { + teamId: option.teamId, + } + : {}), + }, + }); }); }; @@ -108,7 +111,6 @@ export default function CreateEventTypeButton(props: Props) { { - router.push(isOpen ? modalOpen.hrefOn : modalOpen.hrefOff); if (!isOpen) closeModal(); }}> {!hasTeams || props.isIndividualTeam ? (