Skip to content

Conversation

@nicholasio
Copy link
Member

Description of the Change

Closes #922

How to test the Change

Credits

Props @lucymtc

Checklist:

@changeset-bot
Copy link

changeset-bot bot commented Jul 21, 2025

🦋 Changeset detected

Latest commit: 60ae18b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@headstartwp/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jul 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headstartwp-app-router ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2025 10:16pm
headstarwp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2025 10:16pm

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/wp-nextjs-app

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 83.76 KB (🟢 -42.23 KB)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/headstartwp

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Three Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (145 KB)
/ 9.7 KB 135.69 KB 93.58% (🟡 +0.02%)
/[...path] 6.64 KB 132.63 KB 91.47% (🟡 +0.02%)
/blog/[[...path]] 10.14 KB 136.13 KB 93.88% (🟡 +0.03%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/wp-nextjs-app

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 83.76 KB (🟢 -42.23 KB)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/headstartwp

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Three Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (145 KB)
/ 9.68 KB 135.67 KB 93.57% (🟡 +0.01%)
/[...path] 6.62 KB 132.61 KB 91.46% (+/- <0.01%)
/blog/[[...path]] 10.12 KB 136.11 KB 93.87% (🟡 +0.01%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

if (params.fullPath) {
return postPath === params.fullPath.replace(/\/?$/, '/');
}

Copy link
Contributor

Choose a reason for hiding this comment

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

This is failing because it doesn't check for the current path with locale like further down
postPath === /${this.locale}${singlePrefix}${currentPath}``

The patch I had:

const singlePrefix = params?.fullPath
	? ''
	: (postTypeObject?.single?.replace(/\/?$/, '') ?? '');

return (
    postPath === `${singlePrefix}${currentPath}` ||
    postPath === `/${this.locale}${singlePrefix}${currentPath}`
);

As it only needs to have the singlePrefix empty

Copy link
Member Author

@nicholasio nicholasio Jul 24, 2025

Choose a reason for hiding this comment

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

updated the logic to also account for locale

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks! approved @nicholasio

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/wp-nextjs-app

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 83.76 KB (🟢 -42.23 KB)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

@github-actions
Copy link
Contributor

📦 Next.js Bundle Analysis for @10up/headstartwp

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Three Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load % of Budget (145 KB)
/ 9.69 KB 135.68 KB 93.57% (🟡 +0.02%)
/[...path] 6.63 KB 132.62 KB 91.46% (🟡 +0.01%)
/blog/[[...path]] 10.13 KB 136.12 KB 93.88% (🟡 +0.01%)
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.

@nicholasio nicholasio merged commit 27d2999 into develop Jul 25, 2025
20 checks passed
@nicholasio nicholasio deleted the fix/cpt-fullpath-handling branch July 25, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom post types with fullPath parameter fail to match current path due to incorrect singlePrefix handling

2 participants