]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: note about readonly
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 24 Jun 2024 15:24:07 +0000 (17:24 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 24 Jun 2024 15:24:07 +0000 (17:24 +0200)
Close #vuejs/pinia#2701

packages/docs/cookbook/composables.md
packages/docs/core-concepts/index.md

index 1f65952f1486af140a14b1fee184ee4705fea0d7..307bb7e63220c8f3ede0af9b1bb8dc323767486c 100644 (file)
@@ -94,7 +94,7 @@ export const useAuthStore = defineStore('auth', {
 })
 ```
 
-In [Setup Stores](#setup-stores), you need to use a helper named `skipHydrate()` on any state property that shouldn't be picked up from the initial state. Differently from option stores, setup stores cannot just _skip calling `state()`_, so we mark properties that cannot be hydrated with `skipHydrate()`. Note that this only applies to writable reactive properties:
+In [Setup Stores](#setup-stores), you need to use a helper named `skipHydrate()` on any state property that shouldn't be picked up from the initial state. Differently from option stores, setup stores cannot just _skip calling `state()`_, so we mark properties that cannot be hydrated with `skipHydrate()`. Note that this only applies to state properties:
 
 ```ts
 import { defineStore, skipHydrate } from 'pinia'
index 7ce1466acd5c19592a02c82b8964799e76e23485..2cc3474b7733c97a7d56f70b64c0c6fe4bf3e0d1 100644 (file)
@@ -74,7 +74,7 @@ In _Setup Stores_:
 - `computed()`s become `getters`
 - `function()`s become `actions`
 
-Note that you **must** return **all state properties** in setup stores for Pinia to pick them up as state. In other words, you cannot have _private_ state properties in stores. Not returning all state properties can break [SSR](../cookbook/composables.md), devtools, and other plugins.
+Note that you **must** return **all state properties** in setup stores for Pinia to pick them up as state. In other words, you cannot have [_private_ state properties in stores](https://masteringpinia.com/blog/how-to-create-private-state-in-stores). Not returning all state properties or **making them readonly** will break [SSR](../cookbook/composables.md), devtools, and other plugins.
 
 Setup stores bring a lot more flexibility than [Option Stores](#option-stores) as you can create watchers within a store and freely use any [composable](https://vuejs.org/guide/reusability/composables.html#composables). However, keep in mind that using composables will get more complex when using SSR.