Skip to content

Commit

Permalink
Update .changeset/wet-foxes-walk.md
Browse files Browse the repository at this point in the history
Co-authored-by: Bjorn Lu <[email protected]>
  • Loading branch information
ematipico and bluwy authored Oct 1, 2024
1 parent 44841fe commit 79b39f7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .changeset/wet-foxes-walk.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
'astro': major
---

`Astro.params` aren't decoded anymore.
`params` passed in `getStaticPaths` are no longer automatically decoded.

### [changed]: `Astro.params` aren't decoded anymore.
In Astro v4.x, `Astro.params` were decoded using `decodeURIComponent`.
In Astro v4.x, `params` in ` were automatically decoded using `decodeURIComponent`.

Astro v5.0 doesn't decode `Astro.params` anymore, so you'll need to manually decode them yourself.
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 `Astro.params` being decoded for you, you'll need to manually decode it using `decodeURI`.
If you were relying on the automatic decode, you'll need to manually decode it using `decodeURI`.

The use of [`decodeURIComponent`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent)) is discouraged because it decodes more characters than it should, for example `/`, `?`, `#` and more.
Note that the use of [`decodeURIComponent`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent)) is discouraged for `getStaticPaths` because it decodes more characters than it should, for example `/`, `?`, `#` and more.

```diff
---
Expand Down

0 comments on commit 79b39f7

Please sign in to comment.