summaryrefslogtreecommitdiff
path: root/.changeset/cool-mangos-shop.md
diff options
context:
space:
mode:
Diffstat (limited to '.changeset/cool-mangos-shop.md')
-rw-r--r--.changeset/cool-mangos-shop.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/.changeset/cool-mangos-shop.md b/.changeset/cool-mangos-shop.md
new file mode 100644
index 000000000..893ed22e2
--- /dev/null
+++ b/.changeset/cool-mangos-shop.md
@@ -0,0 +1,25 @@
+---
+'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
+})
+```