-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Unify Thank you pages in a reusable component #140
feature: Unify Thank you pages in a reusable component #140
Conversation
Task linked: CU-86dt88j0r Refactor Thank You pages |
We received your feedback! | ||
<br /> | ||
<br /> | ||
Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be passed as a children
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using that as a default because it's shared by 2 out of the 3 pages
useMount(() => { | ||
if (!isProfiling || usePayment) { | ||
|
||
mutate({ email: isProfiling ? account.email : email, phase, submission_id }) | ||
}; | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instead of this it would be better to use a prop named mutateOnMount
, and just do if (mutateOnMount)
.
Also, we could pass the mutationParams
instead of doing this logic here (which is a bit weird because we are passing the phase
from the survey store to the profiling mutation).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small suggestion
if (!submission_id) { | ||
navigate(exitRoute); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another approach to early exit & navigate
if (!submission_id) { | |
navigate(exitRoute); | |
} | |
if (!submission_id) { | |
return <Navigate to={exitRoute} /> | |
} |
</a>{" "} | ||
with a member of our team. | ||
</Typography> | ||
</>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fragment is unnecessary
}: ThankYouProps) => { | ||
const [isLoading, setIsLoading] = useState(mutateOnMount); | ||
const [searchParams] = useSearchParams(); | ||
const submission_id = searchParams.get("submission_id") ?? ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all the submission_id
related stuff should be in the parent components, it shouldn't be a responsibility of the ThankYou
component.
We should pass it in the mutationKey
and mutationParams
, and move the navigate to the parent as well.
This reverts commit ef9bab4.
Refactor Thank You pages ⚡⚡⚡
Resolve: closes -86dt88j0r
Description and Requires ⭐
Refactor code for thank you pages unifying in a single Thank You component
Checklist ✅