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

Fix prerendered dynamic ISR functions with catch-all segments #864

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

benmanns
Copy link
Contributor

@benmanns benmanns commented Aug 26, 2024

This expands on the change in #834 to fix prerendered routes with catch-all (e.g. blog/[...slug]/page.tsx -> blog/foo and blog/category/bar) routes.

I ran into an issue trying to get timlrx/tailwind-nextjs-starter-blog working on Cloudflare Pages. For the most part, everything worked, but for blog posts in particular, there were two issues: first, somewhere in the stack code is eval-ed, so posts cannot be rendered on the edge runtime and must be prerendered. The second: next-on-pages wasn't doing whatever magic it usually does for a typical blog/[slog]/page.tsx, so I was getting an error telling me to add runtime = 'edge'.

This change applies the same fix to [...param] routes as it does [param] routes. I readily admit, I am a backend developer/data engineer not familiar with this codebase, Next.js, Cloudflare Pages, etc. This is working for me, but please validate my assumptions before merging.

I released this package on @benmanns/next-on-pages if anyone (like me) wants to use the changes immediately.

Copy link

changeset-bot bot commented Aug 26, 2024

🦋 Changeset detected

Latest commit: 64e4d8a

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

This PR includes changesets to release 2 packages
Name Type
@cloudflare/next-on-pages Patch
eslint-plugin-next-on-pages 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

Copy link
Contributor

github-actions bot commented Sep 8, 2024

🧪 Prereleases are available for testing 🧪

@cloudflare/next-on-pages

You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/10563926855/npm-package-next-on-pages-864

@cloudflare/eslint-plugin-next-on-pages

You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/10563926855/npm-package-eslint-plugin-next-on-pages-864

Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

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

This looks great @benmanns!

Thanks a lot for the fix 🙂

(and sorry for the late review 😓🙇 )

@dario-piotrowicz dario-piotrowicz merged commit d1dce9e into cloudflare:main Sep 8, 2024
7 of 8 checks passed
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.

2 participants