Skip to content

Commit

Permalink
Merge pull request #342 from kubeshop/mm/fix/cannotclosecreatetestmodal
Browse files Browse the repository at this point in the history
fix: cannot dismiss create test modal
  • Loading branch information
mortada-codes authored Apr 26, 2022
2 parents 4fcd39c + ece0468 commit 2a08b4f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions web/src/pages/Home/HomeContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import * as S from './Home.styled';
const HomeContent: React.FC = () => {
const [openCreateTestModal, setOpenCreateTestModal] = useState(false);

const {setCurrentStep, setIsOpen, currentStep, isOpen} = useGuidedTour(GuidedTours.Home);
const {setCurrentStep, setIsOpen, currentStep, isOpen: isGuidOpen} = useGuidedTour(GuidedTours.Home);

useEffect(() => {
if (currentStep > 0 && !openCreateTestModal) {
if (currentStep > 0 && !openCreateTestModal && isGuidOpen) {
setOpenCreateTestModal(true);
setCurrentStep(2);
delay(() => setCurrentStep(1), 0);
}
}, [currentStep, openCreateTestModal, setCurrentStep]);
}, [currentStep, openCreateTestModal, setCurrentStep, isGuidOpen]);

return (
<S.Wrapper>
Expand All @@ -44,7 +44,7 @@ const HomeContent: React.FC = () => {
size="large"
onClick={() => {
setOpenCreateTestModal(true);
if (isOpen) delay(() => setCurrentStep(currentStep + 1), 1);
if (isGuidOpen) delay(() => setCurrentStep(currentStep + 1), 1);
}}
>
Create Test
Expand Down

0 comments on commit 2a08b4f

Please sign in to comment.