0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00
astro/.changeset/wet-foxes-walk.md
Emanuele Stoppa 8f064fa5b9 fix changeset
2024-10-02 12:23:46 +01:00

950 B

astro
major

params passed in getStaticPaths are no longer automatically decoded.

[changed]: params aren't decoded anymore.

In Astro v4.x, params in were automatically decoded using decodeURIComponent.

Astro v5.0 doesn't automatically decode params in getStaticPaths anymore, so you'll need to manually decode them yourself if needed

What should I do?

If you were relying on the automatic decode, you'll need to manually decode it using decodeURI.

Note that the use of decodeURIComponent) is discouraged for getStaticPaths because it decodes more characters than it should, for example /, ?, # and more.

---
export function getStaticPaths() {
  return [
+    { params: { id: decodeURI("%5Bpage%5D") } },
-    { params: { id: "%5Bpage%5D" } },
  ]
}

const { id } = Astro.params;
---