Home / Function/ renderState() — vue Function Reference

renderState() — vue Function Reference

Architecture documentation for the renderState() function in index.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  e403fe42_26ea_b8a9_bdf7_968ad8b3c29d["renderState()"]
  31cd301c_a88b_c811_2866_b3d6f4b7a004["render()"]
  31cd301c_a88b_c811_2866_b3d6f4b7a004 -->|calls| e403fe42_26ea_b8a9_bdf7_968ad8b3c29d
  e3ce3bef_0e07_77f9_f5f6_bc05b5c0fad9["_flush()"]
  e3ce3bef_0e07_77f9_f5f6_bc05b5c0fad9 -->|calls| e403fe42_26ea_b8a9_bdf7_968ad8b3c29d
  style e403fe42_26ea_b8a9_bdf7_968ad8b3c29d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/server-renderer/src/template-renderer/index.ts lines 227–241

  renderState(
    context: Record<string, any>,
    options?: Record<string, any>
  ): string {
    const { contextKey = 'state', windowKey = '__INITIAL_STATE__' } =
      options || {}
    const state = this.serialize(context[contextKey])
    const autoRemove = __DEV__
      ? ''
      : ';(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());'
    const nonceAttr = context.nonce ? ` nonce="${context.nonce}"` : ''
    return context[contextKey]
      ? `<script${nonceAttr}>window.${windowKey}=${state}${autoRemove}</script>`
      : ''
  }

Subdomains

Called By

Frequently Asked Questions

What does renderState() do?
renderState() is a function in the vue codebase.
What calls renderState()?
renderState() is called by 2 function(s): _flush, render.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free