♻️(demo) remove ready flag

This workaround was used as a workaround because default opened modals
were causing a crash. See #269
This commit is contained in:
Nathan Vasse
2024-02-19 17:02:15 +01:00
committed by NathanVss
parent 266701a733
commit e9956829d1

View File

@@ -1,22 +1,15 @@
import React, { useEffect } from "react";
import React from "react";
import { Button, Modal, ModalSize, useModal } from "@openfun/cunningham-react";
const Onboarding = () => {
const modal = useModal({ isOpenDefault: true });
// FIXME: remove this workaround once issue #259 will be resolved
// https://github.com/openfun/cunningham/issues/259
const [ready, setReady] = React.useState(false);
const handleClose = () => {
sessionStorage.setItem("onboarded", "1");
modal.close();
};
useEffect(() => {
setReady(true);
}, []);
if (!ready || sessionStorage.getItem("onboarded")) return null;
if (sessionStorage.getItem("onboarded")) return null;
return (
<Modal