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

[Prerender] Pages with dynamic routes in the same folder don't work in @2.0.0-beta.2 #5860

Closed
1 task
juanmiguelguerrero opened this issue Jan 14, 2023 · 2 comments · Fixed by #5904
Closed
1 task
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@juanmiguelguerrero
Copy link
Contributor

What version of astro are you using?

2.0.0-beta.2

Are you using an SSR adapter? If so, which one?

Netlify

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

If we have more than one page with dinamic routes in the same folder we get an error.

I have created 2 pages with getStaticPatch [cat].astro and [dog].astro (and prerender = true).

All dog routes doesn't works...

And if you input any route then cat page will appear... never enter in the dog page.

Demo: https://stackblitz.com/github/juanmiguelguerrero/astro-prerender-staticpaths-beta2

If you take out the Netlify adapter configuration... everything works fine.

Link to Minimal Reproducible Example

https://stackblitz.com/github/juanmiguelguerrero/astro-prerender-staticpaths-beta2

Participation

  • I am willing to submit a pull request for this issue.
@bluwy bluwy changed the title Pages with dinamic routes in the same folder don't work in @2.0.0-beta.2 [Prerender] Pages with dynamic routes in the same folder don't work in @2.0.0-beta.2 Jan 16, 2023
@natemoo-re natemoo-re self-assigned this Jan 18, 2023
@matthewp matthewp added the - P4: important Violate documented behavior or significantly impacts performance (priority) label Jan 18, 2023
@natemoo-re
Copy link
Member

This looks like a problem with the way the Netlify adapter is generating the _redirects file. We should be generating a single redirect for each .html file that is prerendered rather than each route that is prerendered.

@natemoo-re natemoo-re assigned matthewp and unassigned natemoo-re Jan 18, 2023
@matthewp matthewp assigned bluwy and unassigned matthewp Jan 18, 2023
@bluwy
Copy link
Member

bluwy commented Jan 19, 2023

It looks like the _redirects is:

/    /.netlify/functions/entry    200
/*   /cat3/index.html    200
/*   /dog3/index.html    200

I don't quite understand what's the desired output though, but I feel like the two latter redirects should be removed?


Also it doesn't seem like this is a build-only issue. During dev, the dogs page will always use the cats Astro files to render since Astro's routing is first-match (IIRC) via the filename-as-regex, and the geStaticPaths is only considered later 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants