Skip to content

Commit c82e089

Browse files
docs: minor corrections (#2879)
1 parent 2a9fd92 commit c82e089

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

packages/docs/cookbook/composables.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Here are some examples of composables that cannot be used in an option stores (b
4040
On the other hand, when defining a setup store, you can use almost any composable since every property gets discerned into state, action, or getter:
4141

4242
```ts
43-
import { defineStore, skipHydrate } from 'pinia'
43+
import { defineStore } from 'pinia'
4444
import { useMediaControls } from '@vueuse/core'
4545

4646
export const useVideoPlayer = defineStore('video', () => {
@@ -78,7 +78,7 @@ When dealing with [Server Side Rendering](../ssr/index.md), you need to take car
7878
In [Option Stores](#option-stores), you need to define a `hydrate()` function. This function is called when the store is instantiated on the client (the browser) when there is an initial state available at the time the store is created. The reason we need to define this function is because in such scenario, `state()` is not called.
7979

8080
```ts
81-
import { defineStore, skipHydrate } from 'pinia'
81+
import { defineStore } from 'pinia'
8282
import { useLocalStorage } from '@vueuse/core'
8383

8484
export const useAuthStore = defineStore('auth', {

packages/docs/cookbook/composing-stores.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ Note that if one store uses another store, you can directly import and call the
4747
When it comes to _setup stores_, you can simply use one of the stores **at the top** of the store function:
4848

4949
```ts
50+
import { defineStore } from 'pinia'
5051
import { useUserStore } from './user'
52+
import { apiPurchase } from './api'
5153

5254
export const useCartStore = defineStore('cart', () => {
5355
const user = useUserStore()
@@ -58,7 +60,7 @@ export const useCartStore = defineStore('cart', () => {
5860
})
5961

6062
function purchase() {
61-
return apiPurchase(user.id, this.list)
63+
return apiPurchase(user.id, list.value)
6264
}
6365

6466
return { summary, purchase }
@@ -91,7 +93,8 @@ The same applies to _actions_:
9193
```js
9294
import { defineStore } from 'pinia'
9395
import { useUserStore } from './user'
94-
96+
import { apiOrderCart } from './api'
97+
9598
export const useCartStore = defineStore('cart', {
9699
actions: {
97100
async orderCart() {
@@ -114,7 +117,8 @@ Since actions can be asynchronous, make sure **all of your `useStore()` calls ap
114117
```js{7-8,11-13}
115118
import { defineStore } from 'pinia'
116119
import { useUserStore } from './user'
117-
120+
import { apiOrderCart } from './api'
121+
118122
export const useCartStore = defineStore('cart', {
119123
actions: {
120124
async orderCart() {

packages/docs/cookbook/vscode-snippets.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
These are some snippets that I use in VS Code to make my life easier.
44

5-
Manage user snippets with <kbd>⇧</kbd> <kbd>⌘</kbd> <kbd>P</kbd> / <kbd>⇧</kbd> <kbd>⌃</kbd> <kbd>P</kbd> and then `Snippets: Configure User Snippets`.
5+
Manage user snippets with <kbd>⇧ Shift</kbd>+<kbd>⌘ Command</kbd>+<kbd>P</kbd> / <kbd>⇧ Shift</kbd>+<kbd>⌃ Control</kbd>+<kbd>P</kbd> and then `Snippets: Configure User Snippets`.
66

77
```json
88
{

0 commit comments

Comments
 (0)