-
Notifications
You must be signed in to change notification settings - Fork 18
feat: new way of transport #872
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
Changes from all commits
d8b4389
a52d6c4
e62bed0
9f6e14b
4d9950b
80aee4f
280cd55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,6 @@ | ||
| /.git | ||
| /.next/cache | ||
| .git | ||
| .gitignore | ||
| .next/cache | ||
| coverage | ||
| *.log | ||
| .env* |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,14 +1,10 @@ | ||||||
| import { notFound } from 'next/navigation' | ||||||
| import { categories } from 'data/categories' | ||||||
| import Category from 'components/outils/Category' | ||||||
| import { simulators } from 'components/outils/simulators' | ||||||
| import { getCategory } from 'utils/category' | ||||||
|
|
||||||
| type Props = { params: Promise<{ tool: string }> } | ||||||
|
|
||||||
| export async function generateStaticParams() { | ||||||
| return categories.map((category) => ({ tool: category.slug })) | ||||||
| } | ||||||
| export const dynamic = 'force-dynamic' | ||||||
|
||||||
| export const dynamic = 'force-dynamic' | |
| export const revalidate = 3600 |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,32 +6,7 @@ import { equivalentsSimulators } from 'components/outils/equivalents/simulators/ | |||||||
| import { getName } from 'utils/Equivalent/equivalent' | ||||||||
| import Suggestion from 'components/layout/Suggestion' | ||||||||
|
|
||||||||
| export async function generateStaticParams() { | ||||||||
| return categories.flatMap((category) => | ||||||||
| category.equivalents | ||||||||
| ? category.equivalents.flatMap((equivalent) => | ||||||||
| equivalent.withCarpool | ||||||||
| ? [ | ||||||||
| { | ||||||||
| tool: category.slug, | ||||||||
| equivalent: equivalent.slug, | ||||||||
| }, | ||||||||
| ...Array.from({ length: 4 }).map((value, index) => ({ | ||||||||
| tool: category.slug, | ||||||||
| equivalent: `${equivalent.slug}+${index + 1}`, | ||||||||
| carpool: index + 1, | ||||||||
| })), | ||||||||
| ] | ||||||||
| : [ | ||||||||
| { | ||||||||
| tool: category.slug, | ||||||||
| equivalent: equivalent.slug, | ||||||||
| }, | ||||||||
| ] | ||||||||
| ) | ||||||||
| : [] | ||||||||
| ) | ||||||||
| } | ||||||||
| export const dynamic = 'force-dynamic' | ||||||||
|
||||||||
| export const dynamic = 'force-dynamic' | |
| export const dynamicParams = true | |
| export const revalidate = 3600 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,8 @@ export async function GET(req: NextRequest, context: { params: Promise<{ slug: s | |
| return NextResponse.json(`Please use ${process.env.NEXT_PUBLIC_IMAGE_URL}`, { status: 400 }) | ||
| } | ||
|
|
||
| const [slug, carpool] = decodeURIComponent((await context.params).slug).split('+') | ||
| const slugParam = decodeURIComponent((await context.params).slug) | ||
| const [slug, carpool] = slugParam.split('+') | ||
|
Comment on lines
+24
to
+25
|
||
| if (!slug) { | ||
| return NextResponse.json('No slug specified', { status: 400 }) | ||
| } | ||
|
|
@@ -52,9 +53,9 @@ export async function GET(req: NextRequest, context: { params: Promise<{ slug: s | |
|
|
||
| return new ImageResponse( | ||
| <Equivalent | ||
| slug={equivalent.slug} | ||
| slug={slug} | ||
| carpool={!!carpool} | ||
| name={getName(language, { ...equivalent, category: 0, carpool: Number(carpool) })} | ||
| name={getName(language, { ...equivalent, slug: slugParam, carpool: Number(carpool) }, false, 1, false, true)} | ||
| quantity={equivalent.value / ((Number(carpool) || 0) + 1)} | ||
| unit={equivalent.unit || category.unit} | ||
| language={language} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same concern as above: making all iframe equivalent pages fully dynamic may be costly operationally. If the motivation is the combinatorial explosion of static params (especially with carpool variants), consider ISR (
revalidate) or switching the carpool selection to a query param so the number of path variants stays manageable for static generation.