Skip to content

Commit

Permalink
Fix early return
Browse files Browse the repository at this point in the history
  • Loading branch information
Debilski committed Aug 9, 2024
1 parent 4aa86fa commit 3e0f9f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/civiewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ export default function CIViewer() {

const jsonPage = searchParams.get('url');

if (!jsonPage) return (<p>No data</p>);

useEffect(() => {
if (!jsonPage) return;

fetch(jsonPage)
.then(response => response.json())
.then(setData);
}, [jsonPage]);

if (!jsonPage) return (<p>No data</p>);

return (
<>
<CITable data={data}></CITable>
Expand Down

0 comments on commit 3e0f9f6

Please sign in to comment.