-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix getStaticPaths regression (#11993)
* Revert "Remove dependency on path-to-regexp (#11983)" This reverts commit 633eeaa. * Add test for regression * Add a changeset * Pin path-to-regexp
- Loading branch information
Showing
6 changed files
with
99 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fix getStaticPaths regression | ||
|
||
This reverts a previous change meant to remove a dependency, to fix a regression with multiple nested spread routes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...es/astro/test/fixtures/get-static-paths-pages/src/pages/archive/[...slug]/[...page].astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
export async function getStaticPaths({ paginate }) { | ||
const paths = [ | ||
{ | ||
slug: 'news/july-2024', | ||
items: ['item 1', 'item 2', 'item 3', 'item 4', 'item 5', 'item 6'], | ||
contentType: 'news', | ||
monthYear: 'july-2024', | ||
} | ||
]; | ||
return paths.flatMap((path) => { | ||
return paginate(path.items, { | ||
params: { slug: path.slug }, | ||
props: { | ||
contentType: path.contentType, | ||
monthYear: path.monthYear, | ||
}, | ||
pageSize: 2, | ||
}); | ||
}); | ||
} | ||
const { slug, page } = Astro.params; | ||
--- | ||
|
||
<html> | ||
<head> | ||
<title>Testing</title> | ||
</head> | ||
<body> | ||
<h1>Testing</h1> | ||
<p id="slug">{slug}</p> | ||
<p id="page">{page}</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.