]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: recommend plain devalue
authorEduardo San Martin Morote <posva13@gmail.com>
Sun, 27 Oct 2024 19:10:48 +0000 (20:10 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Sun, 27 Oct 2024 19:10:54 +0000 (20:10 +0100)
packages/docs/ssr/index.md

index 43f4e7772a64fcdb9a05675a86c036dc19b3c4c4..1d1001c9a5a820375ce795edf4792b22c6f633c5 100644 (file)
@@ -63,10 +63,10 @@ onServerPrefetch(async () => {
 
 ## State hydration
 
-To hydrate the initial state, you need to make sure the rootState is included somewhere in the HTML for Pinia to pick it up later on. Depending on what you are using for SSR, **you should escape the state for security reasons**. We recommend using [@nuxt/devalue](https://github.com/nuxt-contrib/devalue) which is the one used by Nuxt.js:
+To hydrate the initial state, you need to make sure the rootState is included somewhere in the HTML for Pinia to pick it up later on. Depending on what you are using for SSR, **you should escape the state for security reasons**. We recommend using [devalue](https://github.com/Rich-Harris/devalue) which is the one used by Nuxt.js:
 
 ```js
-import devalue from '@nuxt/devalue'
+import devalue from 'devalue'
 import { createPinia } from 'pinia'
 // retrieve the rootState server side
 const pinia = createPinia()
@@ -83,7 +83,7 @@ app.use(pinia)
 devalue(pinia.state.value)
 ```
 
-Depending on what you are using for SSR, you will set an _initial state_ variable that will be serialized in the HTML. You should also protect yourself from XSS attacks. You can use [other alternatives](https://github.com/nuxt-contrib/devalue#see-also) to `@nuxt/devalue` depending on what you need, e.g. if you can serialize and parse your state with `JSON.stringify()`/`JSON.parse()`, **you could improve your performance by a lot**.
+Depending on what you are using for SSR, you will set an _initial state_ variable that will be serialized in the HTML. You should also protect yourself from XSS attacks. You can use [other alternatives](https://github.com/Rich-Harris/devalue#see-also) to `devalue` depending on what you need, e.g. if you can serialize and parse your state with `JSON.stringify()`/`JSON.parse()`, **you could improve your performance by a lot**.
 
 If you are not using Nuxt you will need to handle the serialization and hydration of the state yourself. Here are some examples: