Open oleshkooo opened 1 year ago
+1 on this! @Oleshkooo Have you found the issue here?
Yep seems like generateStaticParams is not triggering for pages inside @slot
+1 on this! @Oleshkooo Have you found the issue here?
Accidentally closed the issue*
Since I couldn't implement my idea at the time, I just had to delete those pages. Now I have updated the "next" version, but I haven't tested it yet. If there are any updates, I'll let you know. I will also be glad to hear about any changes and, hopefully, successes.
Yep seems like generateStaticParams is not triggering for pages inside
@slot
Facing this issue, and end up by replace parallel route (@slot
things) to layout.tsx
.
AS-IS:
.
├── @slot1
│ ├── [slug]
│ │ └── page.tsx # generateStaticParams doesn't work as expected
│ └── page.tsx # export default () => null;
├── @slot2
│ └── default.tsx
├── layout.tsx # export default ({ slot1, slot2 }) => (<>{slot1}{slot2}</>);
└── page.tsx # export default () => null;
TO-BE:
.
├── [slug] # -> @slot1/[slug]
│ └── page.tsx # generateStaticParams works as expected
├── Slot2Component.tsx # -> @slot2/default.tsx
├── layout.tsx # export default ({ children }) => (<>{chidlren}<Slot2Component /></>);
└── page.tsx # export default () => null;
Actually I'm also using this with route group ((group)
things) that can make multiple layout.tsx
for single route.
This approach makes so many annoying folders and layout.tsx
but yeah... works correctly at least
Still relevant on Next.js 14.
@Oleshkooo Unfortunately, this is not a minimal that we can take look. If you can create a minimal , we will be able to take a look at this!
I made a fork of the official example nextgram so it's easier to reproduce, the project is already using "next": "canary".
My Fork:
git clone https://github.com/Jaycedam/nextgram.git
I added the same generateStaticParams() to the route and the modal (single commit). As mentioned in the issue, only the route is SSG, the modal is still dynamic.
Build result:
Route (app) Size First Load JS
┌ ○ / 6.94 kB 91.1 kB
├ ○ /_not-found 885 B 85.1 kB
├ λ /(.)photos/[id] 481 B 84.7 kB
├ ○ /default 143 B 84.3 kB
└ ● /photos/[id] 143 B 84.3 kB
├ /photos/1
├ /photos/2
├ /photos/3
└ [+3 more paths]
+ First Load JS shared by all 84.2 kB
├ chunks/69-ba1ea0421cdf6c89.js 28.9 kB
├ chunks/fd9d1056-0bb21fb122762d6f.js 53.4 kB
└ other shared chunks (total) 1.86 kB
○ (Static) prerendered as static content
● (SSG) prerendered as static HTML (uses getStaticProps)
λ (Dynamic) server-rendered on demand using Node.js
@Jaycedam Thank you for sharing!
I can confirm that this is indeed an issue. We will be looking to fix this!
Reproducible in "next": "^14.1.2"
EDIT: I don't know if this is of any help, but here is some of my findings:
My page heavily uses parallel routing, which ultimately ends in just having dynamic rendering and no SSR at all.
So adding this feature would be really beneficial -> https://patrick-arns.de/
It seems that interception routes were deliberately excluded from static builds: https://github.com/vercel/next.js/pull/61004
I use a CDN in front of my self-hosted setup. This issue creates a problem when the parent page is statically rendered and thus cached by CDN, but the intercepted route (modal) isn't. Therefore after each deployment, I have to clear the full cache since the interception no longer works, and falls back to hard load.
facing the same issue
Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!
Is there any progress on this? I am trying to build a site that has a few modals with static content from a CMS, but they feel really sluggish due to being dynamically generated.
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App Router, Routing (next/router, next/navigation, next/link)
Link to the code that reproduces this issue or a replay of the bug
https://drive.google.com/file/d/1wCb9VkpbAlH1bT-iIcP3dTYnEEOT3Glw/view?usp=sharing
To Reproduce
/src/app/adspaces/[id]/page.tsx
/src/app/@modal/(.)adspaces/[id]/page.tsx
/src/app/layout.tsx
Describe the Bug
/adspaces/[id]
builds normally (SSG), but when I do the same in/(.)adspaces/[id]
, it somehow becomes SSR, even though each of these pages exports the same generateStaticParams function.Expected Behavior
Expected
/(.)adspaces/[id]
page to be SSG as well. It's something like this:Which browser are you using? (if relevant)
Brave, Chrome
How are you deploying your application? (if relevant)
Firebase hosting + firebase functions (firebase does it on its own, I use experimental firebase frameworks)
NEXT-2808