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

Function updateComponent

packages/runtime-core/src/renderer.ts:1282–1311  ·  view source on GitHub ↗
(n1: VNode, n2: VNode, optimized: boolean)

Source from the content-addressed store, hash-verified

1280 }
1281
1282 const updateComponent = (n1: VNode, n2: VNode, optimized: boolean) => {
1283 const instance = (n2.component = n1.component)!
1284 if (shouldUpdateComponent(n1, n2, optimized)) {
1285 if (
1286 __FEATURE_SUSPENSE__ &&
1287 instance.asyncDep &&
1288 !instance.asyncResolved
1289 ) {
1290 // async & still pending - just update props and slots
1291 // since the component's reactive effect for render isn't set-up yet
1292 if (__DEV__) {
1293 pushWarningContext(n2)
1294 }
1295 updateComponentPreRender(instance, n2, optimized)
1296 if (__DEV__) {
1297 popWarningContext()
1298 }
1299 return
1300 } else {
1301 // normal update
1302 instance.next = n2
1303 // instance.update is the reactive effect.
1304 instance.update()
1305 }
1306 } else {
1307 // no update needed. just copy over properties
1308 n2.el = n1.el
1309 instance.vnode = n2
1310 }
1311 }
1312
1313 const setupRenderEffect: SetupRenderEffectFn = (
1314 instance,

Callers 1

processComponentFunction · 0.85

Calls 4

shouldUpdateComponentFunction · 0.90
pushWarningContextFunction · 0.90
popWarningContextFunction · 0.90
updateComponentPreRenderFunction · 0.85

Tested by

no test coverage detected