MCPcopy
hub / github.com/vuejs/core / renderComponentRoot

Function renderComponentRoot

packages/runtime-core/src/componentRenderUtils.ts:52–275  ·  view source on GitHub ↗
(
  instance: ComponentInternalInstance,
)

Source from the content-addressed store, hash-verified

50type SetRootFn = ((root: VNode) => void) | undefined
51
52export function renderComponentRoot(
53 instance: ComponentInternalInstance,
54): VNode {
55 const {
56 type: Component,
57 vnode,
58 proxy,
59 withProxy,
60 propsOptions: [propsOptions],
61 slots,
62 attrs,
63 emit,
64 render,
65 renderCache,
66 props,
67 data,
68 setupState,
69 ctx,
70 inheritAttrs,
71 } = instance
72 const prev = setCurrentRenderingInstance(instance)
73
74 let result
75 let fallthroughAttrs
76 if (__DEV__) {
77 accessedAttrs = false
78 }
79
80 try {
81 if (vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
82 // withProxy is a proxy with a different `has` trap only for
83 // runtime-compiled render functions using `with` block.
84 const proxyToUse = withProxy || proxy
85 // 'this' isn't available in production builds with `<script setup>`,
86 // so warn if it's used in dev.
87 const thisProxy =
88 __DEV__ && setupState.__isScriptSetup
89 ? new Proxy(proxyToUse!, {
90 get(target, key, receiver) {
91 warn(
92 `Property '${String(
93 key,
94 )}' was accessed via 'this'. Avoid using 'this' in templates.`,
95 )
96 return Reflect.get(target, key, receiver)
97 },
98 })
99 : proxyToUse
100 result = normalizeVNode(
101 render!.call(
102 thisProxy,
103 proxyToUse!,
104 renderCache,
105 __DEV__ ? shallowReadonly(props) : props,
106 setupState,
107 data,
108 ctx,
109 ),

Callers 3

hydrateSubTreeFunction · 0.90
componentUpdateFnFunction · 0.90
renderComponentSubTreeFunction · 0.85

Calls 15

normalizeVNodeFunction · 0.90
shallowReadonlyFunction · 0.90
handleErrorFunction · 0.90
cloneVNodeFunction · 0.90
isOnFunction · 0.90
isModelListenerFunction · 0.90
warnFunction · 0.90
isCompatEnabledFunction · 0.90
warnDeprecationFunction · 0.90
getComponentNameFunction · 0.90
setTransitionHooksFunction · 0.90

Tested by

no test coverage detected