render-static.ts — vue Source File
Architecture documentation for render-static.ts, a typescript file in the vue codebase. 2 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 7c4a1871_a8e0_6bbc_abc1_336b9a233c19["render-static.ts"] f6868225_acf7_afdc_ebd3_15704ddb6566["vnode"] 7c4a1871_a8e0_6bbc_abc1_336b9a233c19 --> f6868225_acf7_afdc_ebd3_15704ddb6566 8a5fb776_a8f4_ce8a_8549_67af07f2e1e9["util"] 7c4a1871_a8e0_6bbc_abc1_336b9a233c19 --> 8a5fb776_a8f4_ce8a_8549_67af07f2e1e9 8456d994_c5db_04c1_7466_74c5274c4133["index.ts"] 8456d994_c5db_04c1_7466_74c5274c4133 --> 7c4a1871_a8e0_6bbc_abc1_336b9a233c19 style 7c4a1871_a8e0_6bbc_abc1_336b9a233c19 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import VNode from 'core/vdom/vnode'
import { isArray } from 'core/util'
/**
* Runtime helper for rendering static trees.
*/
export function renderStatic(
index: number,
isInFor: boolean
): VNode | Array<VNode> {
const cached = this._staticTrees || (this._staticTrees = [])
let tree = cached[index]
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree.
if (tree && !isInFor) {
return tree
}
// otherwise, render a fresh tree.
tree = cached[index] = this.$options.staticRenderFns[index].call(
this._renderProxy,
this._c,
this // for render fns generated for functional component templates
)
markStatic(tree, `__static__${index}`, false)
return tree
}
/**
* Runtime helper for v-once.
* Effectively it means marking the node as static with a unique key.
*/
export function markOnce(
tree: VNode | Array<VNode>,
index: number,
key: string
) {
markStatic(tree, `__once__${index}${key ? `_${key}` : ``}`, true)
return tree
}
function markStatic(tree: VNode | Array<VNode>, key: string, isOnce: boolean) {
if (isArray(tree)) {
for (let i = 0; i < tree.length; i++) {
if (tree[i] && typeof tree[i] !== 'string') {
markStaticNode(tree[i], `${key}_${i}`, isOnce)
}
}
} else {
markStaticNode(tree, key, isOnce)
}
}
function markStaticNode(node, key, isOnce) {
node.isStatic = true
node.key = key
node.isOnce = isOnce
}
Domain
Subdomains
Dependencies
- util
- vnode
Imported By
Source
Frequently Asked Questions
What does render-static.ts do?
render-static.ts is a source file in the vue codebase, written in typescript. It belongs to the CoreRuntime domain, Instance subdomain.
What functions are defined in render-static.ts?
render-static.ts defines 4 function(s): markOnce, markStatic, markStaticNode, renderStatic.
What does render-static.ts depend on?
render-static.ts imports 2 module(s): util, vnode.
What files import render-static.ts?
render-static.ts is imported by 1 file(s): index.ts.
Where is render-static.ts in the architecture?
render-static.ts is located at src/core/instance/render-helpers/render-static.ts (domain: CoreRuntime, subdomain: Instance, directory: src/core/instance/render-helpers).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free