Skip to content
Open
Changes from all commits
Commits
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
12 changes: 10 additions & 2 deletions apps/addon-catalog/app/(home)/tag/[...name]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ const getCachedTagFromName = unstable_cache(
['tag-details'],
);

const getCachedTags = unstable_cache(
async () => [
...(await fetchTagsData({ isCategory: true })),
...(await fetchTagsData()).slice(0, 100),
],
Comment on lines +37 to +41
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getCachedTags returns all category tags plus the first 300 non-category tags. That means generateStaticParams() can pre-render more than 300 pages (categories + 300), which seems to conflict with the PR goal of prerendering “the first 300 tag pages”. If the intent is an overall cap, apply the limit after combining (or otherwise clarify/encode the intended cap in code).

Copilot uses AI. Check for mistakes.
Comment on lines +38 to +41
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In getCachedTags, (await fetchTagsData()).slice(0, 300) still fetches the full non-category tag list and only then truncates it. If the tags list is large, this can unnecessarily increase build time/memory and network usage for prerendering. Consider adding a server-side limit (e.g., query arg/variable) or a dedicated data function that only retrieves the needed N tag names.

Copilot uses AI. Check for mistakes.
['tags'],
);

const getCachedCategoryTags = unstable_cache(
async () => fetchTagsData({ isCategory: true }),
['category-tags'],
Expand All @@ -42,7 +50,7 @@ const getCachedCategoryTags = unstable_cache(
export const generateMetadata: GenerateMetaData = async ({ params }) => {
const tagName = (await params).name.join('/');
const data = await getCachedTagFromName([tagName]);
const categoryTags = await getCachedCategoryTags() || [];
const categoryTags = (await getCachedCategoryTags()) || [];

const isCategoryTag = categoryTags.includes(tagName);

Expand Down Expand Up @@ -89,7 +97,7 @@ export default async function TagDetails({
}

export async function generateStaticParams() {
const tags = (await getCachedCategoryTags()) || [];
const tags = (await getCachedTags()) || [];
const listOfNames = tags.map((tag) => ({ name: [...tag.split('/')] }));

if (listOfNames.length === 0) {
Expand Down
Loading