From 92edbeb5822a9f8b68ad6f3659fb54073e44cd41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Ara=C3=BAjo?= Date: Fri, 10 Oct 2025 21:01:09 -0300 Subject: [PATCH 1/6] refactor: cache release data --- .../download/archive/[version]/page.tsx | 2 +- apps/site/components/EOL/EOLReleaseTable.tsx | 83 ---------------- .../EOL/EOLReleaseTable/TableBody.tsx | 68 +++++++++++++ .../components/EOL/EOLReleaseTable/index.tsx | 42 ++++++++ .../Releases/PreviousReleasesTable.tsx | 98 ------------------- .../PreviousReleasesTable/TableBody.tsx | 87 ++++++++++++++++ .../Releases/PreviousReleasesTable/index.tsx | 31 ++++++ apps/site/components/withDownloadArchive.tsx | 2 +- apps/site/components/withDownloadSection.tsx | 13 ++- apps/site/components/withNodeRelease.tsx | 4 +- apps/site/components/withReleaseSelect.tsx | 5 +- apps/site/layouts/Download.tsx | 9 +- apps/site/next-data/providers/releaseData.ts | 6 +- apps/site/next.config.mjs | 1 + 14 files changed, 254 insertions(+), 197 deletions(-) delete mode 100644 apps/site/components/EOL/EOLReleaseTable.tsx create mode 100644 apps/site/components/EOL/EOLReleaseTable/TableBody.tsx create mode 100644 apps/site/components/EOL/EOLReleaseTable/index.tsx delete mode 100644 apps/site/components/Releases/PreviousReleasesTable.tsx create mode 100644 apps/site/components/Releases/PreviousReleasesTable/TableBody.tsx create mode 100644 apps/site/components/Releases/PreviousReleasesTable/index.tsx diff --git a/apps/site/app/[locale]/download/archive/[version]/page.tsx b/apps/site/app/[locale]/download/archive/[version]/page.tsx index f8b627977bab3..2fa7b6040c0cd 100644 --- a/apps/site/app/[locale]/download/archive/[version]/page.tsx +++ b/apps/site/app/[locale]/download/archive/[version]/page.tsx @@ -46,7 +46,7 @@ const getPage: FC = async props => { const [locale, pathname] = basePage.getLocaleAndPath(version, routeLocale); if (version === 'current') { - const releaseData = provideReleaseData(); + const releaseData = await provideReleaseData(); const release = releaseData.find(release => release.status === 'Current'); diff --git a/apps/site/components/EOL/EOLReleaseTable.tsx b/apps/site/components/EOL/EOLReleaseTable.tsx deleted file mode 100644 index 2119fefb8ef03..0000000000000 --- a/apps/site/components/EOL/EOLReleaseTable.tsx +++ /dev/null @@ -1,83 +0,0 @@ -'use client'; - -import { useTranslations } from 'next-intl'; -import { Fragment, useState } from 'react'; -import type { FC } from 'react'; - -import FormattedTime from '#site/components/Common/FormattedTime'; -import LinkWithArrow from '#site/components/Common/LinkWithArrow'; -import EOLModal from '#site/components/EOL/EOLModal'; -import VulnerabilityChips from '#site/components/EOL/VulnerabilityChips'; -import provideReleaseData from '#site/next-data/providers/releaseData'; -import provideVulnerabilities from '#site/next-data/providers/vulnerabilities'; -import { EOL_VERSION_IDENTIFIER } from '#site/next.constants.mjs'; - -const EOLReleaseTable: FC = () => { - const releaseData = provideReleaseData(); - const vulnerabilities = provideVulnerabilities(); - - const eolReleases = releaseData.filter( - release => release.status === EOL_VERSION_IDENTIFIER - ); - - const t = useTranslations(); - - const [currentModal, setCurrentModal] = useState(); - - return ( - - - - - - - - - - - - {eolReleases.map(release => ( - - - - - - - - - - - - open || setCurrentModal(undefined)} - /> - - ))} - -
- {t('components.eolTable.version')} ( - {t('components.eolTable.codename')}) - {t('components.eolTable.lastUpdated')}{t('components.eolTable.vulnerabilities')}{t('components.eolTable.details')}
- v{release.major}{' '} - {release.codename ? `(${release.codename})` : ''} - - - - - - setCurrentModal(release.version)} - > - {t('components.downloadReleasesTable.details')} - -
- ); -}; - -export default EOLReleaseTable; diff --git a/apps/site/components/EOL/EOLReleaseTable/TableBody.tsx b/apps/site/components/EOL/EOLReleaseTable/TableBody.tsx new file mode 100644 index 0000000000000..ee2fa061f37c7 --- /dev/null +++ b/apps/site/components/EOL/EOLReleaseTable/TableBody.tsx @@ -0,0 +1,68 @@ +'use client'; + +import { useTranslations } from 'next-intl'; +import type { FC } from 'react'; +import { Fragment, useState } from 'react'; + +import FormattedTime from '#site/components/Common/FormattedTime'; +import LinkWithArrow from '#site/components/Common/LinkWithArrow'; +import EOLModal from '#site/components/EOL/EOLModal'; +import VulnerabilityChips from '#site/components/EOL/VulnerabilityChips'; +import type { NodeRelease } from '#site/types/releases.js'; +import type { GroupedVulnerabilities } from '#site/types/vulnerabilities.js'; + +type EOLReleaseTableBodyProps = { + eolReleases: Array; + vulnerabilities: GroupedVulnerabilities; +}; + +const EOLReleaseTableBody: FC = ({ + eolReleases, + vulnerabilities, +}) => { + const t = useTranslations(); + + const [currentModal, setCurrentModal] = useState(); + + return ( + + {eolReleases.map(release => ( + + + + v{release.major} {release.codename ? `(${release.codename})` : ''} + + + + + + + + + + + + setCurrentModal(release.version)} + > + {t('components.downloadReleasesTable.details')} + + + + + open || setCurrentModal(undefined)} + /> + + ))} + + ); +}; + +export default EOLReleaseTableBody; diff --git a/apps/site/components/EOL/EOLReleaseTable/index.tsx b/apps/site/components/EOL/EOLReleaseTable/index.tsx new file mode 100644 index 0000000000000..36ee147bf5f7c --- /dev/null +++ b/apps/site/components/EOL/EOLReleaseTable/index.tsx @@ -0,0 +1,42 @@ +import { getTranslations } from 'next-intl/server'; +import type { FC } from 'react'; + +import provideReleaseData from '#site/next-data/providers/releaseData'; +import provideVulnerabilities from '#site/next-data/providers/vulnerabilities'; +import { EOL_VERSION_IDENTIFIER } from '#site/next.constants.mjs'; + +import EOLReleaseTableBody from './TableBody'; + +const EOLReleaseTable: FC = async () => { + const releaseData = await provideReleaseData(); + const vulnerabilities = provideVulnerabilities(); + + const eolReleases = releaseData.filter( + release => release.status === EOL_VERSION_IDENTIFIER + ); + + const t = await getTranslations(); + + return ( + + + + + + + + + + + +
+ {t('components.eolTable.version')} ( + {t('components.eolTable.codename')}) + {t('components.eolTable.lastUpdated')}{t('components.eolTable.vulnerabilities')}{t('components.eolTable.details')}
+ ); +}; + +export default EOLReleaseTable; diff --git a/apps/site/components/Releases/PreviousReleasesTable.tsx b/apps/site/components/Releases/PreviousReleasesTable.tsx deleted file mode 100644 index 58f7846f80fd2..0000000000000 --- a/apps/site/components/Releases/PreviousReleasesTable.tsx +++ /dev/null @@ -1,98 +0,0 @@ -'use client'; - -import Badge from '@node-core/ui-components/Common/Badge'; -import { useTranslations } from 'next-intl'; -import type { FC } from 'react'; -import { Fragment, useState } from 'react'; - -import FormattedTime from '#site/components/Common/FormattedTime'; -import LinkWithArrow from '#site/components/Common/LinkWithArrow'; -import Link from '#site/components/Link'; -import provideReleaseData from '#site/next-data/providers/releaseData'; - -import ReleaseModal from './ReleaseModal'; - -const BADGE_KIND_MAP = { - 'End-of-life': 'warning', - 'Maintenance LTS': 'neutral', - 'Active LTS': 'info', - Current: 'default', - Pending: 'default', -} as const; - -const PreviousReleasesTable: FC = () => { - const releaseData = provideReleaseData(); - - const t = useTranslations(); - - const [currentModal, setCurrentModal] = useState(); - - return ( - - - - - - - - - - - - - - {releaseData.map(release => ( - - - - - - - - - - - - - - - - open || setCurrentModal(undefined)} - /> - - ))} - -
{t('components.downloadReleasesTable.version')}{t('components.downloadReleasesTable.codename')}{t('components.downloadReleasesTable.firstReleased')}{t('components.downloadReleasesTable.lastUpdated')}{t('components.downloadReleasesTable.status')}
- - v{release.major} - - - {release.codename || '-'} - - - - - - - {release.status} - {release.status === 'End-of-life' ? ' (EoL)' : ''} - - - setCurrentModal(release.version)} - > - {t('components.downloadReleasesTable.details')} - -
- ); -}; - -export default PreviousReleasesTable; diff --git a/apps/site/components/Releases/PreviousReleasesTable/TableBody.tsx b/apps/site/components/Releases/PreviousReleasesTable/TableBody.tsx new file mode 100644 index 0000000000000..f5011cac7290d --- /dev/null +++ b/apps/site/components/Releases/PreviousReleasesTable/TableBody.tsx @@ -0,0 +1,87 @@ +'use client'; + +import Badge from '@node-core/ui-components/Common/Badge'; +import { useTranslations } from 'next-intl'; +import type { FC } from 'react'; +import { Fragment, useState } from 'react'; + +import FormattedTime from '#site/components/Common/FormattedTime'; +import LinkWithArrow from '#site/components/Common/LinkWithArrow'; +import Link from '#site/components/Link'; +import type { NodeRelease } from '#site/types/releases.js'; + +import ReleaseModal from '../ReleaseModal'; + +const BADGE_KIND_MAP = { + 'End-of-life': 'warning', + 'Maintenance LTS': 'neutral', + 'Active LTS': 'info', + Current: 'default', + Pending: 'default', +} as const; + +type PreviousReleasesTableBodyProps = { + releaseData: Array; +}; + +const PreviousReleasesTableBody: FC = ({ + releaseData, +}) => { + const t = useTranslations(); + + const [currentModal, setCurrentModal] = useState(); + + return ( + + {releaseData.map(release => ( + + + + + v{release.major} + + + + + {release.codename || '-'} + + + + + + + + + + + + + {release.status} + {release.status === 'End-of-life' ? ' (EoL)' : ''} + + + + + setCurrentModal(release.version)} + > + {t('components.downloadReleasesTable.details')} + + + + + open || setCurrentModal(undefined)} + /> + + ))} + + ); +}; + +export default PreviousReleasesTableBody; diff --git a/apps/site/components/Releases/PreviousReleasesTable/index.tsx b/apps/site/components/Releases/PreviousReleasesTable/index.tsx new file mode 100644 index 0000000000000..342528ec62e32 --- /dev/null +++ b/apps/site/components/Releases/PreviousReleasesTable/index.tsx @@ -0,0 +1,31 @@ +import { getTranslations } from 'next-intl/server'; +import type { FC } from 'react'; + +import provideReleaseData from '#site/next-data/providers/releaseData'; + +import PreviousReleasesTableBody from './TableBody'; + +const PreviousReleasesTable: FC = async () => { + const releaseData = await provideReleaseData(); + + const t = await getTranslations(); + + return ( + + + + + + + + + + + + + +
{t('components.downloadReleasesTable.version')}{t('components.downloadReleasesTable.codename')}{t('components.downloadReleasesTable.firstReleased')}{t('components.downloadReleasesTable.lastUpdated')}{t('components.downloadReleasesTable.status')}
+ ); +}; + +export default PreviousReleasesTable; diff --git a/apps/site/components/withDownloadArchive.tsx b/apps/site/components/withDownloadArchive.tsx index 460150ead3948..df8ecdb70aea0 100644 --- a/apps/site/components/withDownloadArchive.tsx +++ b/apps/site/components/withDownloadArchive.tsx @@ -27,7 +27,7 @@ const WithDownloadArchive: FC = async ({ const version = extractVersionFromPath(pathname); // Find the release data for the given version - const releaseData = provideReleaseData(); + const releaseData = await provideReleaseData(); const release = releaseData.find(release => // Match major version only (e.g., v22.x.x for release.major v22) version.startsWith(`v${release.major}`) diff --git a/apps/site/components/withDownloadSection.tsx b/apps/site/components/withDownloadSection.tsx index 34d76d09d6991..3caa60d024598 100644 --- a/apps/site/components/withDownloadSection.tsx +++ b/apps/site/components/withDownloadSection.tsx @@ -4,20 +4,27 @@ import type { FC, PropsWithChildren } from 'react'; import { getClientContext } from '#site/client-context'; import WithNodeRelease from '#site/components/withNodeRelease'; import provideDownloadSnippets from '#site/next-data/providers/downloadSnippets'; -import provideReleaseData from '#site/next-data/providers/releaseData'; import { defaultLocale } from '#site/next.locales.mjs'; import { ReleaseProvider, ReleasesProvider, } from '#site/providers/releaseProvider'; +import type { NodeRelease } from '../types'; + // By default the translated languages do not contain all the download snippets // Hence we always merge any translated snippet with the fallbacks for missing snippets const fallbackSnippets = provideDownloadSnippets(defaultLocale.code); -const WithDownloadSection: FC = ({ children }) => { +type WithDownloadSectionProps = PropsWithChildren<{ + releases: Array; +}>; + +const WithDownloadSection: FC = ({ + releases, + children, +}) => { const locale = useLocale(); - const releases = provideReleaseData(); const snippets = provideDownloadSnippets(locale); const { pathname } = getClientContext(); diff --git a/apps/site/components/withNodeRelease.tsx b/apps/site/components/withNodeRelease.tsx index 49b7a38bd0fc0..f98483c988bf4 100644 --- a/apps/site/components/withNodeRelease.tsx +++ b/apps/site/components/withNodeRelease.tsx @@ -11,11 +11,11 @@ type WithNodeReleaseProps = { // This is a React Async Server Component // Note that Hooks cannot be used in a RSC async component // Async Components do not get re-rendered at all. -const WithNodeRelease: FC = ({ +const WithNodeRelease: FC = async ({ status, children: Component, }) => { - const releaseData = provideReleaseData(); + const releaseData = await provideReleaseData(); const matchingRelease = releaseData.find(release => [status].flat().includes(release.status) diff --git a/apps/site/components/withReleaseSelect.tsx b/apps/site/components/withReleaseSelect.tsx index e48a94b19a98e..49663e1794316 100644 --- a/apps/site/components/withReleaseSelect.tsx +++ b/apps/site/components/withReleaseSelect.tsx @@ -5,7 +5,6 @@ import type { ComponentProps, FC } from 'react'; import Link from '#site/components/Link'; import { useRouter } from '#site/navigation.mjs'; -import provideReleaseData from '#site/next-data/providers/releaseData'; import type { NodeRelease } from '#site/types'; import { STATUS_ORDER } from '#site/util/download'; @@ -44,9 +43,9 @@ type WithReleaseSelectProps = Omit< >; const WithReleaseSelect: FC = ({ ...props }) => { - const releaseData = provideReleaseData(); + // const releaseData = provideReleaseData(); const { push } = useRouter(); - const navigation = groupReleasesByStatus(releaseData); + const navigation = groupReleasesByStatus([]); // fix later return ( = ({ children }) => { +const DownloadLayout: FC = async ({ children }) => { const { frontmatter } = getClientContext(); + const releases = await provideReleaseData(); + return ( <> @@ -18,7 +21,9 @@ const DownloadLayout: FC = ({ children }) => {

{frontmatter.title}

- {children} + + {children} +
diff --git a/apps/site/next-data/providers/releaseData.ts b/apps/site/next-data/providers/releaseData.ts index 04f37ac05eeda..1ccae9de036dd 100644 --- a/apps/site/next-data/providers/releaseData.ts +++ b/apps/site/next-data/providers/releaseData.ts @@ -1,9 +1,7 @@ -import { cache } from 'react'; +'use cache'; import generateReleaseData from '#site/next-data/generators/releaseData.mjs'; -const releaseData = await generateReleaseData(); - -const provideReleaseData = cache(() => releaseData); +const provideReleaseData = async () => generateReleaseData(); export default provideReleaseData; diff --git a/apps/site/next.config.mjs b/apps/site/next.config.mjs index 8eb650197844e..7396448b79b18 100644 --- a/apps/site/next.config.mjs +++ b/apps/site/next.config.mjs @@ -80,6 +80,7 @@ const nextConfig = { // we also configure ESLint to run its lint checking on all files eslint: { ignoreDuringBuilds: true }, experimental: { + useCache: true, // Ensure that server-side code is also minified serverMinification: true, // Use Workers and Threads for webpack compilation From 571db29d7e7b71b76ccba7ce872238a8ac94061a Mon Sep 17 00:00:00 2001 From: avivkeller Date: Thu, 16 Oct 2025 13:08:23 -0400 Subject: [PATCH 2/6] try something --- apps/site/components/withDownloadArchive.tsx | 7 +++++-- apps/site/components/withNodeRelease.tsx | 2 ++ apps/site/components/withReleaseSelect.tsx | 12 ++++++++---- apps/site/pages/en/download/archive/index.mdx | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/apps/site/components/withDownloadArchive.tsx b/apps/site/components/withDownloadArchive.tsx index df8ecdb70aea0..7013b3b84c05d 100644 --- a/apps/site/components/withDownloadArchive.tsx +++ b/apps/site/components/withDownloadArchive.tsx @@ -3,12 +3,15 @@ import type { FC } from 'react'; import { getClientContext } from '#site/client-context'; import provideReleaseData from '#site/next-data/providers/releaseData'; +import type { NodeRelease } from '#site/types'; import { buildReleaseArtifacts, extractVersionFromPath, } from '#site/util/download/archive'; -type DownloadArchive = ReturnType; +type DownloadArchive = ReturnType & { + releases: Array; +}; type WithDownloadArchiveProps = { children: FC; @@ -39,7 +42,7 @@ const WithDownloadArchive: FC = async ({ const releaseArtifacts = buildReleaseArtifacts(release, version); - return ; + return ; }; export default WithDownloadArchive; diff --git a/apps/site/components/withNodeRelease.tsx b/apps/site/components/withNodeRelease.tsx index f98483c988bf4..078c0c8ceed76 100644 --- a/apps/site/components/withNodeRelease.tsx +++ b/apps/site/components/withNodeRelease.tsx @@ -1,3 +1,5 @@ +'use server'; + import type { FC } from 'react'; import provideReleaseData from '#site/next-data/providers/releaseData'; diff --git a/apps/site/components/withReleaseSelect.tsx b/apps/site/components/withReleaseSelect.tsx index 49663e1794316..d4fdc6355c031 100644 --- a/apps/site/components/withReleaseSelect.tsx +++ b/apps/site/components/withReleaseSelect.tsx @@ -40,12 +40,16 @@ const groupReleasesByStatus = (releases: Array) => { type WithReleaseSelectProps = Omit< ComponentProps, 'values' | 'as' | 'onChange' ->; +> & { + releases: Array; +}; -const WithReleaseSelect: FC = ({ ...props }) => { - // const releaseData = provideReleaseData(); +const WithReleaseSelect: FC = ({ + releases, + ...props +}) => { + const navigation = groupReleasesByStatus(releases); const { push } = useRouter(); - const navigation = groupReleasesByStatus([]); // fix later return ( - {({ binaries, installers, version, release, sources }) => ( + {({ releases, binaries, installers, version, release, sources }) => ( <>

Node.js® Download Archive

@@ -42,7 +42,7 @@ layout: download-archive

Other releases

- +

Binary Downloads

From 875e63df526081da42a9dddcf03ffef346c8a5a5 Mon Sep 17 00:00:00 2001 From: avivkeller Date: Sat, 18 Oct 2025 11:20:30 -0400 Subject: [PATCH 3/6] wip --- apps/site/components/withDownloadArchive.tsx | 7 ++--- apps/site/components/withReleaseSelect.tsx | 26 +++++++------------ apps/site/pages/en/download/archive/index.mdx | 4 +-- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/apps/site/components/withDownloadArchive.tsx b/apps/site/components/withDownloadArchive.tsx index 7013b3b84c05d..df8ecdb70aea0 100644 --- a/apps/site/components/withDownloadArchive.tsx +++ b/apps/site/components/withDownloadArchive.tsx @@ -3,15 +3,12 @@ import type { FC } from 'react'; import { getClientContext } from '#site/client-context'; import provideReleaseData from '#site/next-data/providers/releaseData'; -import type { NodeRelease } from '#site/types'; import { buildReleaseArtifacts, extractVersionFromPath, } from '#site/util/download/archive'; -type DownloadArchive = ReturnType & { - releases: Array; -}; +type DownloadArchive = ReturnType; type WithDownloadArchiveProps = { children: FC; @@ -42,7 +39,7 @@ const WithDownloadArchive: FC = async ({ const releaseArtifacts = buildReleaseArtifacts(release, version); - return ; + return ; }; export default WithDownloadArchive; diff --git a/apps/site/components/withReleaseSelect.tsx b/apps/site/components/withReleaseSelect.tsx index d4fdc6355c031..5dbd64c009d8c 100644 --- a/apps/site/components/withReleaseSelect.tsx +++ b/apps/site/components/withReleaseSelect.tsx @@ -1,10 +1,10 @@ -'use client'; +'use server'; -import WithNoScriptSelect from '@node-core/ui-components/Common/Select/NoScriptSelect'; +import StatelessSelect from '@node-core/ui-components/Common/Select/StatelessSelect'; import type { ComponentProps, FC } from 'react'; import Link from '#site/components/Link'; -import { useRouter } from '#site/navigation.mjs'; +import provideReleaseData from '#site/next-data/providers/releaseData'; import type { NodeRelease } from '#site/types'; import { STATUS_ORDER } from '#site/util/download'; @@ -38,25 +38,19 @@ const groupReleasesByStatus = (releases: Array) => { }; type WithReleaseSelectProps = Omit< - ComponentProps, - 'values' | 'as' | 'onChange' -> & { - releases: Array; -}; + ComponentProps, + 'values' | 'as' +>; -const WithReleaseSelect: FC = ({ - releases, - ...props -}) => { - const navigation = groupReleasesByStatus(releases); - const { push } = useRouter(); +const WithReleaseSelect: FC = async ({ ...props }) => { + const releaseData = await provideReleaseData(); + const navigation = groupReleasesByStatus(releaseData); return ( - diff --git a/apps/site/pages/en/download/archive/index.mdx b/apps/site/pages/en/download/archive/index.mdx index 831fef0e0532a..e8a0ea76c9537 100644 --- a/apps/site/pages/en/download/archive/index.mdx +++ b/apps/site/pages/en/download/archive/index.mdx @@ -4,7 +4,7 @@ layout: download-archive --- - {({ releases, binaries, installers, version, release, sources }) => ( + {({ binaries, installers, version, release, sources }) => ( <>

Node.js® Download Archive

@@ -42,7 +42,7 @@ layout: download-archive

Other releases

- +

Binary Downloads

From bc8620759471ab911be960e38bfaa78291496284 Mon Sep 17 00:00:00 2001 From: avivkeller Date: Sat, 18 Oct 2025 11:27:19 -0400 Subject: [PATCH 4/6] 404 on server --- apps/site/app/[locale]/not-found.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/site/app/[locale]/not-found.tsx b/apps/site/app/[locale]/not-found.tsx index 0842df54d486e..bca476307ac22 100644 --- a/apps/site/app/[locale]/not-found.tsx +++ b/apps/site/app/[locale]/not-found.tsx @@ -1,15 +1,15 @@ -'use client'; +'use server'; import { ArrowRightIcon } from '@heroicons/react/24/solid'; -import { useTranslations } from 'next-intl'; +import { getTranslations } from 'next-intl/server'; import type { FC } from 'react'; import Button from '#site/components/Common/Button'; import Turtle from '#site/components/Common/Turtle'; import GlowingBackdropLayout from '#site/layouts/GlowingBackdrop'; -const NotFoundPage: FC = () => { - const t = useTranslations(); +const NotFoundPage: FC = async () => { + const t = await getTranslations(); return ( From 353b1709a8d32a2a52e2424e101af0085c2017ca Mon Sep 17 00:00:00 2001 From: avivkeller Date: Sat, 18 Oct 2025 12:11:10 -0400 Subject: [PATCH 5/6] cache more stuff --- apps/site/components/EOL/EOLReleaseTable/index.tsx | 2 +- apps/site/components/withSupporters.tsx | 4 ++-- apps/site/next-data/providers/releaseData.ts | 4 +--- apps/site/next-data/providers/releaseVersions.ts | 8 ++------ apps/site/next-data/providers/supportersData.mjs | 8 ++------ apps/site/next-data/providers/vulnerabilities.ts | 8 ++------ apps/site/next.dynamic.constants.mjs | 2 +- 7 files changed, 11 insertions(+), 25 deletions(-) diff --git a/apps/site/components/EOL/EOLReleaseTable/index.tsx b/apps/site/components/EOL/EOLReleaseTable/index.tsx index 36ee147bf5f7c..d1e15f6dc37de 100644 --- a/apps/site/components/EOL/EOLReleaseTable/index.tsx +++ b/apps/site/components/EOL/EOLReleaseTable/index.tsx @@ -9,7 +9,7 @@ import EOLReleaseTableBody from './TableBody'; const EOLReleaseTable: FC = async () => { const releaseData = await provideReleaseData(); - const vulnerabilities = provideVulnerabilities(); + const vulnerabilities = await provideVulnerabilities(); const eolReleases = releaseData.filter( release => release.status === EOL_VERSION_IDENTIFIER diff --git a/apps/site/components/withSupporters.tsx b/apps/site/components/withSupporters.tsx index 2227e653d6385..653d0ff2a78d0 100644 --- a/apps/site/components/withSupporters.tsx +++ b/apps/site/components/withSupporters.tsx @@ -6,8 +6,8 @@ import SupportersList from './Common/Supporters'; import provideSupporters from '#site/next-data/providers/supportersData'; -const WithSupporters: FC = () => { - const supporters = provideSupporters(); +const WithSupporters: FC = async () => { + const supporters = await provideSupporters(); return (
diff --git a/apps/site/next-data/providers/releaseData.ts b/apps/site/next-data/providers/releaseData.ts index 1ccae9de036dd..c063dd8fd5ea5 100644 --- a/apps/site/next-data/providers/releaseData.ts +++ b/apps/site/next-data/providers/releaseData.ts @@ -1,7 +1,5 @@ 'use cache'; -import generateReleaseData from '#site/next-data/generators/releaseData.mjs'; - -const provideReleaseData = async () => generateReleaseData(); +import provideReleaseData from '#site/next-data/generators/releaseData.mjs'; export default provideReleaseData; diff --git a/apps/site/next-data/providers/releaseVersions.ts b/apps/site/next-data/providers/releaseVersions.ts index f7ac4d86d010d..d9aa33346dc41 100644 --- a/apps/site/next-data/providers/releaseVersions.ts +++ b/apps/site/next-data/providers/releaseVersions.ts @@ -1,9 +1,5 @@ -import { cache } from 'react'; +'use cache'; -import generateAllVersionsData from '#site/next-data/generators/releaseVersions.mjs'; - -const releaseVersions = await generateAllVersionsData(); - -const provideReleaseVersions = cache(() => releaseVersions); +import provideReleaseVersions from '#site/next-data/generators/releaseVersions.mjs'; export default provideReleaseVersions; diff --git a/apps/site/next-data/providers/supportersData.mjs b/apps/site/next-data/providers/supportersData.mjs index a5479b43f03e3..500cd94fabea9 100644 --- a/apps/site/next-data/providers/supportersData.mjs +++ b/apps/site/next-data/providers/supportersData.mjs @@ -1,9 +1,5 @@ -import { cache } from 'react'; +'use cache'; -import { fetchOpenCollectiveData } from '#site/next-data/generators/supportersData.mjs'; - -const openCollectiveSupporters = await fetchOpenCollectiveData(); - -const provideSupporters = cache(() => openCollectiveSupporters); +import { fetchOpenCollectiveData as provideSupporters } from '#site/next-data/generators/supportersData.mjs'; export default provideSupporters; diff --git a/apps/site/next-data/providers/vulnerabilities.ts b/apps/site/next-data/providers/vulnerabilities.ts index cfc3cce008ba0..e360781eebd10 100644 --- a/apps/site/next-data/providers/vulnerabilities.ts +++ b/apps/site/next-data/providers/vulnerabilities.ts @@ -1,9 +1,5 @@ -import { cache } from 'react'; +'use cache'; -import generateVulnerabilities from '#site/next-data/generators/vulnerabilities.mjs'; - -const vulnerabilities = await generateVulnerabilities(); - -const provideVulnerabilities = cache(() => vulnerabilities); +import provideVulnerabilities from '#site/next-data/generators/vulnerabilities.mjs'; export default provideVulnerabilities; diff --git a/apps/site/next.dynamic.constants.mjs b/apps/site/next.dynamic.constants.mjs index 68860ee2e2a0f..9bfb778935761 100644 --- a/apps/site/next.dynamic.constants.mjs +++ b/apps/site/next.dynamic.constants.mjs @@ -38,7 +38,7 @@ export const BLOG_DYNAMIC_ROUTES = [ export const ARCHIVE_DYNAMIC_ROUTES = [ // Creates dynamic routes for downloads archive pages for each version // (e.g., /download/archive/v18.20.8, /download/archive/v20.19.2) - ...provideReleaseVersions(), + ...(await provideReleaseVersions()), ]; /** From 6c9ce69aa07c0b93734f1249298cb4a52e1b0ef8 Mon Sep 17 00:00:00 2001 From: avivkeller Date: Sat, 18 Oct 2025 12:21:54 -0400 Subject: [PATCH 6/6] Revert "cache more stuff" This reverts commit 353b1709a8d32a2a52e2424e101af0085c2017ca. --- apps/site/components/EOL/EOLReleaseTable/index.tsx | 2 +- apps/site/components/withSupporters.tsx | 4 ++-- apps/site/next-data/providers/releaseData.ts | 4 +++- apps/site/next-data/providers/releaseVersions.ts | 8 ++++++-- apps/site/next-data/providers/supportersData.mjs | 8 ++++++-- apps/site/next-data/providers/vulnerabilities.ts | 8 ++++++-- apps/site/next.dynamic.constants.mjs | 2 +- 7 files changed, 25 insertions(+), 11 deletions(-) diff --git a/apps/site/components/EOL/EOLReleaseTable/index.tsx b/apps/site/components/EOL/EOLReleaseTable/index.tsx index d1e15f6dc37de..36ee147bf5f7c 100644 --- a/apps/site/components/EOL/EOLReleaseTable/index.tsx +++ b/apps/site/components/EOL/EOLReleaseTable/index.tsx @@ -9,7 +9,7 @@ import EOLReleaseTableBody from './TableBody'; const EOLReleaseTable: FC = async () => { const releaseData = await provideReleaseData(); - const vulnerabilities = await provideVulnerabilities(); + const vulnerabilities = provideVulnerabilities(); const eolReleases = releaseData.filter( release => release.status === EOL_VERSION_IDENTIFIER diff --git a/apps/site/components/withSupporters.tsx b/apps/site/components/withSupporters.tsx index 653d0ff2a78d0..2227e653d6385 100644 --- a/apps/site/components/withSupporters.tsx +++ b/apps/site/components/withSupporters.tsx @@ -6,8 +6,8 @@ import SupportersList from './Common/Supporters'; import provideSupporters from '#site/next-data/providers/supportersData'; -const WithSupporters: FC = async () => { - const supporters = await provideSupporters(); +const WithSupporters: FC = () => { + const supporters = provideSupporters(); return (
diff --git a/apps/site/next-data/providers/releaseData.ts b/apps/site/next-data/providers/releaseData.ts index c063dd8fd5ea5..1ccae9de036dd 100644 --- a/apps/site/next-data/providers/releaseData.ts +++ b/apps/site/next-data/providers/releaseData.ts @@ -1,5 +1,7 @@ 'use cache'; -import provideReleaseData from '#site/next-data/generators/releaseData.mjs'; +import generateReleaseData from '#site/next-data/generators/releaseData.mjs'; + +const provideReleaseData = async () => generateReleaseData(); export default provideReleaseData; diff --git a/apps/site/next-data/providers/releaseVersions.ts b/apps/site/next-data/providers/releaseVersions.ts index d9aa33346dc41..f7ac4d86d010d 100644 --- a/apps/site/next-data/providers/releaseVersions.ts +++ b/apps/site/next-data/providers/releaseVersions.ts @@ -1,5 +1,9 @@ -'use cache'; +import { cache } from 'react'; -import provideReleaseVersions from '#site/next-data/generators/releaseVersions.mjs'; +import generateAllVersionsData from '#site/next-data/generators/releaseVersions.mjs'; + +const releaseVersions = await generateAllVersionsData(); + +const provideReleaseVersions = cache(() => releaseVersions); export default provideReleaseVersions; diff --git a/apps/site/next-data/providers/supportersData.mjs b/apps/site/next-data/providers/supportersData.mjs index 500cd94fabea9..a5479b43f03e3 100644 --- a/apps/site/next-data/providers/supportersData.mjs +++ b/apps/site/next-data/providers/supportersData.mjs @@ -1,5 +1,9 @@ -'use cache'; +import { cache } from 'react'; -import { fetchOpenCollectiveData as provideSupporters } from '#site/next-data/generators/supportersData.mjs'; +import { fetchOpenCollectiveData } from '#site/next-data/generators/supportersData.mjs'; + +const openCollectiveSupporters = await fetchOpenCollectiveData(); + +const provideSupporters = cache(() => openCollectiveSupporters); export default provideSupporters; diff --git a/apps/site/next-data/providers/vulnerabilities.ts b/apps/site/next-data/providers/vulnerabilities.ts index e360781eebd10..cfc3cce008ba0 100644 --- a/apps/site/next-data/providers/vulnerabilities.ts +++ b/apps/site/next-data/providers/vulnerabilities.ts @@ -1,5 +1,9 @@ -'use cache'; +import { cache } from 'react'; -import provideVulnerabilities from '#site/next-data/generators/vulnerabilities.mjs'; +import generateVulnerabilities from '#site/next-data/generators/vulnerabilities.mjs'; + +const vulnerabilities = await generateVulnerabilities(); + +const provideVulnerabilities = cache(() => vulnerabilities); export default provideVulnerabilities; diff --git a/apps/site/next.dynamic.constants.mjs b/apps/site/next.dynamic.constants.mjs index 9bfb778935761..68860ee2e2a0f 100644 --- a/apps/site/next.dynamic.constants.mjs +++ b/apps/site/next.dynamic.constants.mjs @@ -38,7 +38,7 @@ export const BLOG_DYNAMIC_ROUTES = [ export const ARCHIVE_DYNAMIC_ROUTES = [ // Creates dynamic routes for downloads archive pages for each version // (e.g., /download/archive/v18.20.8, /download/archive/v20.19.2) - ...(await provideReleaseVersions()), + ...provideReleaseVersions(), ]; /**