0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00
astro/.changeset/cool-mangos-shop.md
Florian Lefebvre bf90a5343f
feat(next): TODOs (#11987)
* feat(next): TODOs

* fix: remove todos

* Updates tests to not assign locals

* Changesets

* Update .changeset/cool-mangos-shop.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update .changeset/blue-sloths-stare.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update .changeset/blue-sloths-stare.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update .changeset/blue-sloths-stare.md

---------

Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
2024-09-13 14:12:33 -04:00

25 lines
512 B
Markdown

---
'astro': major
---
The `locals` object can no longer be overridden
Middleware, API endpoints, and pages can no longer override the `locals` object in its entirety. You can still append values onto the object, but you can not replace the entire object and delete its existing values.
If you were previously overwriting like so:
```js
ctx.locals = {
one: 1,
two: 2
}
```
This can be changed to an assignment on the existing object instead:
```js
Object.assign(ctx.locals, {
one: 1,
two: 2
})
```