From 3e0f9f61b847505c33932a6ca5860368bc17bedb Mon Sep 17 00:00:00 2001 From: Rike-Benjamin Schuppner Date: Fri, 9 Aug 2024 15:50:06 +0200 Subject: [PATCH] Fix early return --- app/civiewer.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/civiewer.tsx b/app/civiewer.tsx index 0a70402..0c72103 100644 --- a/app/civiewer.tsx +++ b/app/civiewer.tsx @@ -43,14 +43,16 @@ export default function CIViewer() { const jsonPage = searchParams.get('url'); - if (!jsonPage) return (

No data

); - useEffect(() => { + if (!jsonPage) return; + fetch(jsonPage) .then(response => response.json()) .then(setData); }, [jsonPage]); + if (!jsonPage) return (

No data

); + return ( <>