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

Function setupRenderEffect

packages/runtime-core/src/renderer.ts:1313–1621  ·  view source on GitHub ↗
(
    instance,
    initialVNode,
    container,
    anchor,
    parentSuspense,
    namespace: ElementNamespace,
    optimized,
  )

Source from the content-addressed store, hash-verified

1311 }
1312
1313 const setupRenderEffect: SetupRenderEffectFn = (
1314 instance,
1315 initialVNode,
1316 container,
1317 anchor,
1318 parentSuspense,
1319 namespace: ElementNamespace,
1320 optimized,
1321 ) => {
1322 const componentUpdateFn = () => {
1323 if (!instance.isMounted) {
1324 let vnodeHook: VNodeHook | null | undefined
1325 const { el, props } = initialVNode
1326 const { bm, m, parent, root, type } = instance
1327 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode)
1328
1329 toggleRecurse(instance, false)
1330 // beforeMount hook
1331 if (bm) {
1332 invokeArrayFns(bm)
1333 }
1334 // onVnodeBeforeMount
1335 if (
1336 !isAsyncWrapperVNode &&
1337 (vnodeHook = props && props.onVnodeBeforeMount)
1338 ) {
1339 invokeVNodeHook(vnodeHook, parent, initialVNode)
1340 }
1341 if (
1342 __COMPAT__ &&
1343 isCompatEnabled(DeprecationTypes.INSTANCE_EVENT_HOOKS, instance)
1344 ) {
1345 instance.emit('hook:beforeMount')
1346 }
1347 toggleRecurse(instance, true)
1348
1349 if (el && hydrateNode) {
1350 // vnode has adopted host node - perform hydration instead of mount.
1351 const hydrateSubTree = () => {
1352 if (__DEV__) {
1353 startMeasure(instance, `render`)
1354 }
1355 instance.subTree = renderComponentRoot(instance)
1356 if (__DEV__) {
1357 endMeasure(instance, `render`)
1358 }
1359 if (__DEV__) {
1360 startMeasure(instance, `hydrate`)
1361 }
1362 hydrateNode!(
1363 el as Node,
1364 instance.subTree,
1365 instance,
1366 parentSuspense,
1367 null,
1368 )
1369 if (__DEV__) {
1370 endMeasure(instance, `hydrate`)

Callers 2

mountComponentFunction · 0.85
registerDepFunction · 0.85

Calls 6

queueJobFunction · 0.90
invokeArrayFnsFunction · 0.90
toggleRecurseFunction · 0.85
onMethod · 0.65
offMethod · 0.65
updateFunction · 0.50

Tested by

no test coverage detected