Skip to content

fix(@angular/ssr): support getPrerenderParams for wildcard routes #30156

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

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

alan-agius4
Copy link
Collaborator

Cherry-pick of #30072

Handle `getPrerenderParams` return values when used with wildcard route paths, including support for combined routes like `/product/:id/**`.
Supports returning an array of path segments (e.g., `['category', '123']`) for `**` routes and dynamic segments combined with catch-all routes.

This enables more flexible prerendering configurations in server routes, including handling specific paths such as `/product/1/laptop/123`.

Example:
```ts
{
  path: '/product/:id/**',
  renderMode: RenderMode.Prerender,
  async getPrerenderParams() {
    return [
      { id: '1', '**': 'laptop/123' },
      { id: '2', '**': 'laptop/456' }
    ];
  }
}
```

Closes angular#30035

(cherry picked from commit cb3446e)
@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Apr 23, 2025
@alan-agius4 alan-agius4 linked an issue Apr 23, 2025 that may be closed by this pull request
1 task
@alan-agius4 alan-agius4 merged commit a4e415e into angular:19.2.x Apr 23, 2025
33 checks passed
@alan-agius4 alan-agius4 deleted the wildcard-ssr-patch branch April 23, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: @angular/ssr target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot pre-render wildcard routes when using outputMode: 'server'
2 participants