♻️(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:
@@ -1,22 +1,15 @@
|
|||||||
import React, { useEffect } from "react";
|
import React from "react";
|
||||||
import { Button, Modal, ModalSize, useModal } from "@openfun/cunningham-react";
|
import { Button, Modal, ModalSize, useModal } from "@openfun/cunningham-react";
|
||||||
|
|
||||||
const Onboarding = () => {
|
const Onboarding = () => {
|
||||||
const modal = useModal({ isOpenDefault: true });
|
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 = () => {
|
const handleClose = () => {
|
||||||
sessionStorage.setItem("onboarded", "1");
|
sessionStorage.setItem("onboarded", "1");
|
||||||
modal.close();
|
modal.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
if (sessionStorage.getItem("onboarded")) return null;
|
||||||
setReady(true);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (!ready || sessionStorage.getItem("onboarded")) return null;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
|||||||
Reference in New Issue
Block a user