You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core-concepts/plugins.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ You can add properties to every store by simply returning an object of them in a
53
53
pinia.use(() => ({ hello:'world' }))
54
54
```
55
55
56
-
You can also set the property directly on the `store`:
56
+
You can also set the property directly on the `store` but **if possible use the return version so they can be automatically tracked by devtools**:
57
57
58
58
```js
59
59
pinia.use(({ store }) => {
@@ -108,6 +108,17 @@ pinia.use(({ store }) => {
108
108
})
109
109
```
110
110
111
+
Any property _returned_ by a plugin will be automatically tracked by devtools so in order to make `hasError` visible in devtools, make sure to add it to `store._customProperties`**in dev mode only** if you want to debug it in devtools:
112
+
113
+
```js
114
+
// from the example above
115
+
pinia.use(({ store }) => {
116
+
store.$state.secret= globalSecret
117
+
store.secret= globalSecret
118
+
store._customProperties.add('secret')
119
+
})
120
+
```
121
+
111
122
:::warning
112
123
If you are using **Vue 2**, Pinia is subject to the [same reactivity caveats](https://vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats) as Vue. You will need to use `set` from `@vue/composition-api`:
0 commit comments