]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: escapeHTML note
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 9 Feb 2021 10:27:20 +0000 (11:27 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 9 Feb 2021 10:27:20 +0000 (11:27 +0100)
README.md
src/rootStore.ts

index 98810309a0d3eb6ddd9b8285ae6de48bf0270728..248867c5d3e8a067d751919d40b5a9d26e83e0bc 100644 (file)
--- a/README.md
+++ b/README.md
@@ -318,8 +318,9 @@ app.use(pinia)
 // after rendering the page, the root state is build and can be read
 // serialize, escape (VERY important if the content of the state can be changed
 // by the user, which is almost always the case), and place it somewhere on
-// the page, for example, as a global variable.
-JSON.stringify(pinia.state.value)
+// the page, for example, as a global variable. Note you need to use your own
+// `escapeHTML()` function or use an existing package
+escapeHTML(JSON.stringify(pinia.state.value))
 ```
 
 On client side, you must hydrate pinia's state before calling any `useStore()` function. For example, if we serialize the state into a `<script>` tag to make it accessible globally on client side through `window.__pinia`, we can write this:
index 6c63f6b9601b36522d892fe674b087d7602fe08e..1cc261d680c7731a2b0fae9351ac93d6ee8463d8 100644 (file)
@@ -39,9 +39,8 @@ export const getActivePinia = () => {
 }
 
 /**
- * The api needs more work we must be able to use the store easily in any
- * function by calling `useStore` to get the store Instance and we also need to
- * be able to reset the store instance between applications on the server
+ * Map of stores based on a Pinia instance. Allows setting and retrieving stores
+ * for the current running application (with its pinia).
  */
 
 export const storesMap = new WeakMap<
@@ -154,7 +153,7 @@ export function createPinia(): Pinia {
 export interface PiniaCustomProperties {}
 
 /**
- * Registered stores
+ * Registered stores used for devtools. TODO: move to devtools
  */
 export const stores = /*#__PURE__*/ new Set<GenericStore>()