From 21d2e8b75d58904069fcc95829fa81e077c31da7 Mon Sep 17 00:00:00 2001 From: ShootingStar91 Date: Thu, 9 Nov 2023 13:07:34 +0200 Subject: [PATCH] [Changelog] Fix front page not showing any if latest releases were internals --- .../frontend/src/components/Frontpage/Changelog.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/services/frontend/src/components/Frontpage/Changelog.jsx b/services/frontend/src/components/Frontpage/Changelog.jsx index 5418e37c21..eac2ecddb2 100644 --- a/services/frontend/src/components/Frontpage/Changelog.jsx +++ b/services/frontend/src/components/Frontpage/Changelog.jsx @@ -11,9 +11,15 @@ export const Changelog = ({ showFullChangelog }) => { const [itemsToShow, setItemsToShow] = useState([]) const { data, isLoading } = useGetChangelogQuery() + const filterInternalReleases = release => !release.title.startsWith('Internal:') + useEffect(() => { if (!data) return - setItemsToShow(showFullChangelog ? [...data.slice(0, 20)] : [...data.slice(0, 2)]) + setItemsToShow( + showFullChangelog + ? [...data.filter(filterInternalReleases).slice(0, 20)] + : [...data.filter(filterInternalReleases).slice(0, 2)] + ) }, [data, showFullChangelog]) const formatDate = dateString => { @@ -30,8 +36,6 @@ export const Changelog = ({ showFullChangelog }) => { return releaseString } - const filterInternalReleases = release => !release.title.startsWith('Internal:') - if (isLoading || itemsToShow.length === 0) return return ( @@ -42,7 +46,7 @@ export const Changelog = ({ showFullChangelog }) => {

Last update on: {builtAt ? formatDate(builtAt) : formatDate(itemsToShow[0].time)}

)} - {itemsToShow.filter(filterInternalReleases).map(release => ( + {itemsToShow.map(release => (