()
| 4 | export const ssrContextKey: unique symbol = Symbol.for('v-scx') |
| 5 | |
| 6 | export const useSSRContext = <T = Record<string, any>>(): T | undefined => { |
| 7 | if (!__GLOBAL__) { |
| 8 | const ctx = inject<T>(ssrContextKey) |
| 9 | if (!ctx) { |
| 10 | __DEV__ && |
| 11 | warn( |
| 12 | `Server rendering context not provided. Make sure to only call ` + |
| 13 | `useSSRContext() conditionally in the server build.`, |
| 14 | ) |
| 15 | } |
| 16 | return ctx |
| 17 | } else if (__DEV__) { |
| 18 | warn(`useSSRContext() is not supported in the global build.`) |
| 19 | } |
| 20 | } |