Skip to content

Commit

Permalink
[HOTFIX]: delegation secondary TOS (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
aziolek authored Jul 15, 2024
2 parents ada46e2 + b9137b6 commit 2196855
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions client/src/components/shared/ModalOnboarding/ModalOnboarding.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cx from 'classnames';
import { AnimatePresence, AnimationProps, motion } from 'framer-motion';
import React, { useState, useEffect, useCallback, FC } from 'react';
import React, { useState, useEffect, useCallback, ReactNode } from 'react';
import { useAccount } from 'wagmi';

import Img from 'components/ui/Img';
Expand All @@ -23,10 +23,10 @@ const motionAnimationProps: AnimationProps = {
transition: { duration: 0.15, ease: 'easeOut' },
};

const ModalOnboarding: FC = () => {
const ModalOnboarding = (): ReactNode => {
const { isConnected } = useAccount();
const { data: isUserTOSAccepted, isFetching: isFetchingUserTOS } = useUserTOS();

const { address } = useAccount();
const {
setIsOnboardingDone,
isOnboardingDone,
Expand All @@ -50,7 +50,7 @@ const ModalOnboarding: FC = () => {
isAllocateOnboardingAlwaysVisible: state.data.isAllocateOnboardingAlwaysVisible,
}));

const [isUserTOSAcceptedInitial] = useState(isUserTOSAccepted);
const [isUserTOSAcceptedInitial, setIsUserTOSAcceptedInitial] = useState(isUserTOSAccepted);

const stepsToUse = useOnboardingSteps(isUserTOSAcceptedInitial);

Expand Down Expand Up @@ -131,6 +131,11 @@ const ModalOnboarding: FC = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isUserTOSAccepted]);

useEffect(() => {
if (isFetchingUserTOS) {return;}
setIsUserTOSAcceptedInitial(isUserTOSAccepted);
}, [address, isFetchingUserTOS, isUserTOSAccepted]);

return (
<Modal
bodyClassName={styles.onboardingModalBody}
Expand Down

0 comments on commit 2196855

Please sign in to comment.