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

Function __asyncHydrate

packages/runtime-core/src/apiAsyncComponent.ts:125–156  ·  view source on GitHub ↗
(el, instance, hydrate)

Source from the content-addressed store, hash-verified

123 __asyncLoader: load,
124
125 __asyncHydrate(el, instance, hydrate) {
126 let patched = false
127 ;(instance.bu || (instance.bu = [])).push(() => (patched = true))
128 const performHydrate = () => {
129 // skip hydration if the component has been patched
130 if (patched) {
131 if (__DEV__) {
132 warn(
133 `Skipping lazy hydration for component '${getComponentName(resolvedComp!) || resolvedComp!.__file}': ` +
134 `it was updated before lazy hydration performed.`,
135 )
136 }
137 return
138 }
139 hydrate()
140 }
141 const doHydrate = hydrateStrategy
142 ? () => {
143 const teardown = hydrateStrategy(performHydrate, cb =>
144 forEachElement(el, cb),
145 )
146 if (teardown) {
147 ;(instance.bum || (instance.bum = [])).push(teardown)
148 }
149 }
150 : performHydrate
151 if (resolvedComp) {
152 doHydrate()
153 } else {
154 load().then(() => !instance.isUnmounted && doHydrate())
155 }
156 },
157
158 get __asyncResolved() {
159 return resolvedComp

Callers

nothing calls this directly

Calls 4

forEachElementFunction · 0.90
doHydrateFunction · 0.85
loadFunction · 0.70
pushMethod · 0.65

Tested by

no test coverage detected