diff --git a/docs/api/README.md b/docs/api/README.md index 88e3f64..890d80b 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -614,6 +614,8 @@ These attributes define specific features when used in a metaInfo property When adding a metaInfo property that should be added once without reactivity (thus will never be updated) you can add `once: true` to the property. +> `once` only works reliably during SSR. When using `once` in components, you need to also use `skip` and store a skip status outside of the component scope. + ```js { metaInfo: { @@ -625,6 +627,24 @@ When adding a metaInfo property that should be added once without reactivity (th } } ``` +or in combination with `skip` +```js +let theJsHasBeenAddedSoSkipIt = false // <-- outside the component scope + +export default { + ... + head() { + const skip = theJsHasBeenAddedSoSkipIt + theJsHasBeenAddedSoSkipIt = true + + return { + script: [ + { once: true, skip, src: '/file.js' } + ] + } + } +} +``` ### skip