Skip to content

Commit 0a027de

Browse files
committed
meta: remove weird fetch/generator thingies, rely on next's internal revalidate api
1 parent 3628c11 commit 0a027de

14 files changed

Lines changed: 39 additions & 121 deletions

File tree

apps/site/app/[locale]/layout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import '#site/styles/index.css';
1414

1515
const fontClasses = classNames(IBM_PLEX_MONO.variable, OPEN_SANS.variable);
1616

17-
type RotLayoutProps = PropsWithChildren<{ params: { locale: string } }>;
17+
type RotLayoutProps = PropsWithChildren<{
18+
params: Promise<{ locale: string }>;
19+
}>;
1820

1921
const RootLayout: FC<RotLayoutProps> = async ({ children, params }) => {
2022
const { locale } = await params;

apps/site/app/[locale]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type DynamicParams = { params: Promise<DynamicStaticPaths> };
3131

3232
// This is the default Viewport Metadata
3333
// @see https://nextjs.org/docs/app/api-reference/functions/generate-viewport#generateviewport-function
34-
export const generateViewport = async () => ({ ...PAGE_VIEWPORT });
34+
export const generateViewport = () => ({ ...PAGE_VIEWPORT });
3535

3636
// This generates each page's HTML Metadata
3737
// @see https://nextjs.org/docs/app/api-reference/functions/generate-metadata

apps/site/components/Downloads/DownloadReleasesTable/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import Badge from '@node-core/ui-components/Common/Badge';
2-
import { getTranslations } from 'next-intl/server';
2+
import { useTranslations } from 'next-intl';
33
import type { FC } from 'react';
44

55
import FormattedTime from '#site/components/Common/FormattedTime';
66
import DetailsButton from '#site/components/Downloads/DownloadReleasesTable/DetailsButton';
7-
import getReleaseData from '#site/next-data/releaseData';
7+
import provideReleaseData from '#site/next-data/providers/releaseData';
88

99
const BADGE_KIND_MAP = {
1010
'End-of-life': 'warning',
@@ -14,10 +14,9 @@ const BADGE_KIND_MAP = {
1414
Pending: 'default',
1515
} as const;
1616

17-
const DownloadReleasesTable: FC = async () => {
18-
const releaseData = await getReleaseData();
19-
20-
const t = await getTranslations();
17+
const DownloadReleasesTable: FC = () => {
18+
const releaseData = provideReleaseData();
19+
const t = useTranslations();
2120

2221
return (
2322
<table id="tbVersions" className="download-table full-width">

apps/site/components/withBlogCrossLinks.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import CrossLink from '#site/components/Common/CrossLink';
55
import getBlogData from '#site/next-data/blogData';
66
import type { BlogCategory } from '#site/types';
77

8-
const WithBlogCrossLinks: FC = async () => {
8+
const WithBlogCrossLinks: FC = () => {
99
const { pathname } = getClientContext();
1010

1111
// Extracts from the static URL the components used for the Blog Post slug
1212
const [, , category, postname] = pathname.split('/');
1313

14-
const { posts } = await getBlogData(category as BlogCategory);
14+
const { posts } = getBlogData(category as BlogCategory);
1515

1616
const currentItem = posts.findIndex(
1717
({ slug }) => slug === `/blog/${category}/${postname}`

apps/site/components/withDownloadSection.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { getLocale } from 'next-intl/server';
1+
import { useLocale } from 'next-intl';
22
import type { FC, PropsWithChildren } from 'react';
33

44
import { getClientContext } from '#site/client-context';
55
import WithNodeRelease from '#site/components/withNodeRelease';
6-
import getDownloadSnippets from '#site/next-data/downloadSnippets';
7-
import getReleaseData from '#site/next-data/releaseData';
6+
import provideDownloadSnippets from '#site/next-data/providers/downloadSnippets';
7+
import provideReleaseData from '#site/next-data/providers/releaseData';
88
import { defaultLocale } from '#site/next.locales.mjs';
99
import {
1010
ReleaseProvider,
@@ -13,12 +13,13 @@ import {
1313

1414
// By default the translated languages do not contain all the download snippets
1515
// Hence we always merge any translated snippet with the fallbacks for missing snippets
16-
const fallbackSnippets = await getDownloadSnippets(defaultLocale.code);
16+
const fallbackSnippets = provideDownloadSnippets(defaultLocale.code);
1717

18-
const WithDownloadSection: FC<PropsWithChildren> = async ({ children }) => {
19-
const locale = await getLocale();
20-
const releases = await getReleaseData();
21-
const snippets = await getDownloadSnippets(locale);
18+
const WithDownloadSection: FC<PropsWithChildren> = ({ children }) => {
19+
const locale = useLocale();
20+
const releases = provideReleaseData();
21+
22+
const snippets = provideDownloadSnippets(locale);
2223
const { pathname } = getClientContext();
2324

2425
// Some available translations do not have download snippets translated or have them partially translated

apps/site/components/withFooter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const WithFooter: FC = async () => {
2828
};
2929

3030
const primary = (
31-
<>
31+
<div className="flex flex-row gap-2">
3232
<WithNodeRelease status="Active LTS">
3333
{({ release }) => (
3434
<BadgeGroup
@@ -53,7 +53,7 @@ const WithFooter: FC = async () => {
5353
</BadgeGroup>
5454
)}
5555
</WithNodeRelease>
56-
</>
56+
</div>
5757
);
5858

5959
return (

apps/site/components/withNodeRelease.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { FC } from 'react';
22

3-
import getReleaseData from '#site/next-data/releaseData';
3+
import provideReleaseData from '#site/next-data/providers/releaseData';
44
import type { NodeRelease, NodeReleaseStatus } from '#site/types';
55

66
type WithNodeReleaseProps = {
@@ -11,11 +11,11 @@ type WithNodeReleaseProps = {
1111
// This is a React Async Server Component
1212
// Note that Hooks cannot be used in a RSC async component
1313
// Async Components do not get re-rendered at all.
14-
const WithNodeRelease: FC<WithNodeReleaseProps> = async ({
14+
const WithNodeRelease: FC<WithNodeReleaseProps> = ({
1515
status,
1616
children: Component,
1717
}) => {
18-
const releaseData = await getReleaseData();
18+
const releaseData = provideReleaseData();
1919

2020
const matchingRelease = releaseData.find(release =>
2121
[status].flat().includes(release.status)

apps/site/layouts/Blog.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getTranslations } from 'next-intl/server';
1+
import { useTranslations } from 'next-intl';
22
import type { FC } from 'react';
33

44
import { getClientContext } from '#site/client-context';
@@ -17,12 +17,15 @@ const getBlogCategory = (pathname: string) => {
1717
// hence we attempt to interpolate the full /en/blog/{category}/page/{page}
1818
// and in case of course no page argument is provided we define it to 1
1919
// note that malformed routes can't happen as they are all statically generated
20-
const [, , category = 'all', , page = 1] = pathname.split('/');
20+
const [, , category = 'all', , page = 1] = pathname.split('/') as [
21+
unknown,
22+
unknown,
23+
BlogCategory,
24+
unknown,
25+
number,
26+
];
2127

22-
const { posts, pagination } = getBlogData(
23-
category as BlogCategory,
24-
Number(page)
25-
);
28+
const { posts, pagination } = getBlogData(category, Number(page));
2629

2730
return {
2831
category: category,
@@ -32,9 +35,9 @@ const getBlogCategory = (pathname: string) => {
3235
};
3336
};
3437

35-
const BlogLayout: FC = async () => {
38+
const BlogLayout: FC = () => {
39+
const t = useTranslations();
3640
const { pathname } = getClientContext();
37-
const t = await getTranslations();
3841

3942
const mapCategoriesToTabs = (categories: Array<BlogCategory>) =>
4043
categories.map(category => ({

apps/site/layouts/Download.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import WithNavBar from '#site/components/withNavBar';
77

88
import styles from './layouts.module.css';
99

10-
const DownloadLayout: FC<PropsWithChildren> = async ({ children }) => {
10+
const DownloadLayout: FC<PropsWithChildren> = ({ children }) => {
1111
const { frontmatter } = getClientContext();
1212

1313
return (

apps/site/next-data/downloadSnippets.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)