From 03f9269eb6b837c98835ad52fb830d9236905ec9 Mon Sep 17 00:00:00 2001 From: daniyal Date: Tue, 3 Sep 2024 15:23:07 +0500 Subject: [PATCH] fix: fetch mods withoud limit filter on landing page and apply limit once retrived --- src/pages/home.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/home.tsx b/src/pages/home.tsx index 7bf25f3..dc642cd 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -249,10 +249,12 @@ const DisplayLatestMods = () => { const [latestMods, setLatestMods] = useState([]) useDidMount(() => { - fetchMods({ source: window.location.host, limit: 4 }) + fetchMods({ source: window.location.host }) .then((res) => { - res.sort((a, b) => b.published_at - a.published_at) - setLatestMods(res) + const mods = res + .sort((a, b) => b.published_at - a.published_at) + .slice(0, 4) + setLatestMods(mods) }) .finally(() => { setIsFetchingLatestMods(false)