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
  a7382fc7_2a1c_21c4_593d_a281d216bdcd["renderState()"]
  6267c156_f90f_17b7_4f37_300535e21f45["TemplateRenderer"]
  a7382fc7_2a1c_21c4_593d_a281d216bdcd -->|defined in| 6267c156_f90f_17b7_4f37_300535e21f45
  31737441_3215_1599_6096_babd073ce4a3["render()"]
  31737441_3215_1599_6096_babd073ce4a3 -->|calls| a7382fc7_2a1c_21c4_593d_a281d216bdcd
  b5113cab_d984_a93c_89b1_a197387b5da3["_flush()"]
  b5113cab_d984_a93c_89b1_a197387b5da3 -->|calls| a7382fc7_2a1c_21c4_593d_a281d216bdcd
  style a7382fc7_2a1c_21c4_593d_a281d216bdcd 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, defined in packages/server-renderer/src/template-renderer/index.ts.
Where is renderState() defined?
renderState() is defined in packages/server-renderer/src/template-renderer/index.ts at line 227.
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