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

Function endBatch

packages/reactivity/src/effect.ts:273–310  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

271 * @internal
272 */
273export function endBatch(): void {
274 if (--batchDepth > 0) {
275 return
276 }
277
278 if (batchedComputed) {
279 let e: Subscriber | undefined = batchedComputed
280 batchedComputed = undefined
281 while (e) {
282 const next: Subscriber | undefined = e.next
283 e.next = undefined
284 e.flags &= ~EffectFlags.NOTIFIED
285 e = next
286 }
287 }
288
289 let error: unknown
290 while (batchedSub) {
291 let e: Subscriber | undefined = batchedSub
292 batchedSub = undefined
293 while (e) {
294 const next: Subscriber | undefined = e.next
295 e.next = undefined
296 e.flags &= ~EffectFlags.NOTIFIED
297 if (e.flags & EffectFlags.ACTIVE) {
298 try {
299 // ACTIVE flag is effect-only
300 ;(e as ReactiveEffect).trigger()
301 } catch (err) {
302 if (!error) error = err
303 }
304 }
305 e = next
306 }
307 }
308
309 if (error) throw error
310}
311
312function prepareDeps(sub: Subscriber) {
313 // Prepare deps for tracking, starting from the head

Callers 4

noTrackingFunction · 0.90
notifyMethod · 0.90
triggerFunction · 0.90
effect.spec.tsFile · 0.90

Calls 1

triggerMethod · 0.45

Tested by

no test coverage detected