Skip to content

Commit 2eb8949

Browse files
committed
Revert "Lazy load Statistics Modal"
This reverts commit 62feb55.
1 parent 62feb55 commit 2eb8949

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

frontend/src/components/LinkList.tsx

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { lazy, Suspense } from 'react'
2-
31
import { useEffect, useState } from 'react'
42
import { Link } from '../types/api'
53
import { getAllLinks, deleteLink } from '../api/client'
@@ -24,7 +22,7 @@ import {
2422
DialogFooter,
2523
} from "@/components/ui/dialog"
2624

27-
const StatisticsModal = lazy(() => import('./StatisticsModal'))
25+
import { StatisticsModal } from "./StatisticsModal"
2826

2927
interface LinkListProps {
3028
refresh?: number;
@@ -87,13 +85,13 @@ export function LinkList({ refresh = 0 }: LinkListProps) {
8785
const baseUrl = window.location.origin
8886
navigator.clipboard.writeText(`${baseUrl}/${shortCode}`)
8987
toast({
90-
description: (
91-
<>
92-
Link copied to clipboard
93-
<br />
94-
You can add ?source=TextHere to the end of the link to track the source of clicks
95-
</>
96-
),
88+
description: (
89+
<>
90+
Link copied to clipboard
91+
<br />
92+
You can add ?source=TextHere to the end of the link to track the source of clicks
93+
</>
94+
),
9795
})
9896
}
9997

@@ -188,15 +186,11 @@ export function LinkList({ refresh = 0 }: LinkListProps) {
188186
</div>
189187
</CardContent>
190188
</Card>
191-
{statsModal.isOpen && (
192-
<Suspense fallback={<div>Loading...</div>}>
193-
<StatisticsModal
194-
isOpen={statsModal.isOpen}
195-
onClose={() => setStatsModal({ isOpen: false, linkId: null })}
196-
linkId={statsModal.linkId!}
197-
/>
198-
</Suspense>
199-
)}
189+
<StatisticsModal
190+
isOpen={statsModal.isOpen}
191+
onClose={() => setStatsModal({ isOpen: false, linkId: null })}
192+
linkId={statsModal.linkId!}
193+
/>
200194
</>
201195
)
202196
}

frontend/src/components/StatisticsModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const CustomTooltip = ({
5858
return null;
5959
};
6060

61-
export default function StatisticsModal({ isOpen, onClose, linkId }: StatisticsModalProps) {
61+
export function StatisticsModal({ isOpen, onClose, linkId }: StatisticsModalProps) {
6262
const [clicksOverTime, setClicksOverTime] = useState<EnhancedClickStats[]>([]);
6363
const [sourcesData, setSourcesData] = useState<SourceStats[]>([]);
6464
const [loading, setLoading] = useState(true);

0 commit comments

Comments
 (0)