Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Exploration of ppr, dynamicIO and rootParams #1531

Draft
wants to merge 43 commits into
base: v4
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d1a0308
Use `dynamicParams = false` instead of manually calling `notFound()`
amannn Nov 11, 2024
f54b01d
upgrade example-app-router to latest next.js canary
amannn Nov 11, 2024
550a734
dynamicIO, ppr, remove dynamicParams = false
amannn Nov 11, 2024
096033a
read locale from `getLocale`, use hypothetical api to read params dee…
amannn Nov 12, 2024
e78099d
Lazy-init `now` when `useNow` or `format.relativeTime` is used in com…
amannn Nov 12, 2024
7c528cf
Don't create default value for `now` when inheriting in `NextIntlClie…
amannn Nov 12, 2024
246e828
update test
amannn Nov 13, 2024
76adb07
fix test
amannn Nov 13, 2024
99a3135
fix docs
amannn Nov 13, 2024
7e11418
fix comment
amannn Nov 13, 2024
a892a44
fix test
amannn Nov 13, 2024
6738b27
Merge branch 'feat/dio-now' into feat/next-future
amannn Nov 13, 2024
36460f1
disable manifest for now
amannn Nov 13, 2024
80b4aad
latest canary
amannn Nov 13, 2024
2e83967
add suspense
amannn Nov 13, 2024
cf075fd
move suspense up a level
amannn Nov 13, 2024
204b5df
feat!: Don't read a default for `locale` from `useParams.locale` on t…
amannn Nov 13, 2024
4b678cd
adapt docs
amannn Nov 13, 2024
17a9602
fix playground, minor docs fixes
amannn Nov 13, 2024
f9f15b9
Merge branch 'feat/dio-no-params' into feat/next-future
amannn Nov 13, 2024
1e66d07
Lazy read `now` only when necessary in `createFormatter`
amannn Nov 14, 2024
36230db
Merge branch 'feat/dio-now' into feat/dio-no-params
amannn Nov 14, 2024
79fea4f
Merge branch 'feat/dio-no-params' into feat/next-future
amannn Nov 14, 2024
b470184
bump size
amannn Nov 14, 2024
3e9a7c7
Merge branch 'feat/dio-now' into feat/dio-no-params
amannn Nov 14, 2024
ea3d97d
Merge branch 'feat/dio-no-params' into feat/next-future
amannn Nov 14, 2024
6063dd2
fix race condition for linting example-app-router-playground
amannn Nov 14, 2024
0de0e48
Merge branch 'feat/dio-now' into feat/dio-no-params
amannn Nov 14, 2024
fe9ede2
Merge branch 'feat/dio-no-params' into feat/next-future
amannn Nov 14, 2024
846fae8
fix syntax error
amannn Nov 14, 2024
2e9d353
Merge branch 'feat/dio-now' into feat/dio-no-params
amannn Nov 14, 2024
9ccc4a0
Merge branch 'feat/dio-no-params' into feat/next-future
amannn Nov 14, 2024
b483092
remove global now
amannn Nov 14, 2024
0eac577
Merge remote-tracking branch 'origin/v4' into feat/next-future
amannn Nov 14, 2024
0172f35
revert docs changes
amannn Nov 14, 2024
eaf67fa
Merge remote-tracking branch 'origin/v4' into feat/next-future
amannn Nov 19, 2024
7e09d85
small improvement
amannn Nov 19, 2024
353fa17
use case for overriding locale [skip ci]
amannn Nov 19, 2024
9f6910f
Merge remote-tracking branch 'origin/v4' into feat/next-future
amannn Feb 28, 2025
69f0ea9
Merge branch 'v4' into feat/next-future
amannn Feb 28, 2025
5e7a79e
wip
amannn Feb 28, 2025
c15ed67
Merge branch 'v4' into feat/next-future
amannn Feb 28, 2025
7a4da91
remove some stuff so rootParams works
amannn Feb 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dynamicIO, ppr, remove dynamicParams = false
  • Loading branch information
amannn committed Nov 11, 2024
commit 550a734179eca634d13262dd79a344c8f407aef4
7 changes: 6 additions & 1 deletion examples/example-app-router/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ const withNextIntl = createNextIntlPlugin({
});

/** @type {import('next').NextConfig} */
const config = {};
const config = {
experimental: {
dynamicIO: true,
ppr: true
}
};

export default withNextIntl(config);
31 changes: 23 additions & 8 deletions examples/example-app-router/src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Locale} from 'next-intl';
import {getTranslations, setRequestLocale} from 'next-intl/server';
import {ReactNode} from 'react';
import {notFound} from 'next/navigation';
import {Locale, hasLocale} from 'next-intl';
import {getTranslations} from 'next-intl/server';
import {ReactNode, Suspense} from 'react';
import BaseLayout from '@/components/BaseLayout';
import {routing} from '@/i18n/routing';

Expand All @@ -22,13 +23,27 @@ export async function generateMetadata({params}: Omit<Props, 'children'>) {
};
}

// Return a 404 for unknown locales
export const dynamicParams = false;
export default function LocaleLayoutMain(props: Props) {
return (
<Suspense
fallback={
<html lang="en">
<body>
<div>Loading …</div>
</body>
</html>
}
>
<LocaleLayout {...props} />
</Suspense>
);
}

export default async function LocaleLayout({children, params}: Props) {
// Enable static rendering
async function LocaleLayout({children, params}: Props) {
const {locale} = await params;
setRequestLocale(locale);
if (!hasLocale(routing.locales, locale)) {
notFound();
}

return <BaseLayout locale={locale}>{children}</BaseLayout>;
}
14 changes: 2 additions & 12 deletions examples/example-app-router/src/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import {Locale, useTranslations} from 'next-intl';
import {setRequestLocale} from 'next-intl/server';
import {use} from 'react';
import {useTranslations} from 'next-intl';
import PageLayout from '@/components/PageLayout';

type Props = {
params: Promise<{locale: Locale}>;
};

export default function IndexPage({params}: Props) {
// Enable static rendering
const {locale} = use(params);
setRequestLocale(locale);

export default function IndexPage() {
const t = useTranslations('IndexPage');

return (
Expand Down
14 changes: 2 additions & 12 deletions examples/example-app-router/src/app/[locale]/pathnames/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
import {Locale, useTranslations} from 'next-intl';
import {setRequestLocale} from 'next-intl/server';
import {use} from 'react';
import {useTranslations} from 'next-intl';
import PageLayout from '@/components/PageLayout';

type Props = {
params: Promise<{locale: Locale}>;
};

export default function PathnamesPage({params}: Props) {
// Enable static rendering
const {locale} = use(params);
setRequestLocale(locale);

export default function PathnamesPage() {
const t = useTranslations('PathnamesPage');

return (
Expand Down
Loading