Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

fix: external warning

AykutSarac01762ea80412
diff --git a/src/layout/ExternalMode/index.tsx b/src/layout/ExternalMode/index.tsx
index 848e77a5..00408dbe 100644
--- a/src/layout/ExternalMode/index.tsx
+++ b/src/layout/ExternalMode/index.tsx
@@ -37,21 +37,22 @@ const StyledTitle = styled.div`
}
`;
-const isExternal = () => {
- if (typeof window === "undefined") return true;
-
- if (window.location.pathname.includes("widget")) return false;
- if (window.location.host !== "jsoncrack.com") return true;
- return false;
-};
-
const ExternalMode = () => {
+ const [isExternal, setExternal] = React.useState(false);
const [isOpen, setOpen] = React.useState(false);
- if (!isExternal()) return null;
+ React.useEffect(() => {
+ if (typeof window !== "undefined") {
+ if (window.location.pathname.includes("widget")) return setExternal(false);
+ if (window.location.host !== "jsoncrack.com") return setExternal(true);
+ return setExternal(false);
+ }
+ }, []);
const closeModal = () => setOpen(false);
+ if (isExternal) return null;
+
return (
<StyledAlert>
<Button