MCPcopy
hub / github.com/wavetermdev/waveterm / runEffect

Method runEffect

tsunami/engine/rootelem.go:365–386  ·  view source on GitHub ↗
(work *EffectWorkElem, hook *Hook)

Source from the content-addressed store, hash-verified

363}
364
365func (r *RootElem) runEffect(work *EffectWorkElem, hook *Hook) {
366 defer func() {
367 comp := r.CompMap[work.WaveId]
368 compName := ""
369 if comp != nil {
370 compName = comp.ContainingComp
371 }
372 util.PanicHandler(fmt.Sprintf("UseEffect run - comp: %s", compName), recover())
373 }()
374 if hook.Fn == nil {
375 return
376 }
377 effectCtx := &EffectContextImpl{
378 WorkElem: *work,
379 WorkType: "run",
380 Root: r,
381 }
382 unmountFn := withGlobalEffectCtx(effectCtx, func() func() {
383 return hook.Fn()
384 })
385 hook.UnmountFn = unmountFn
386}
387
388// this will be called by the frontend to say the DOM has been mounted
389// it will eventually send any updated "refs" to the backend as well

Callers 1

RunWorkMethod · 0.95

Calls 2

PanicHandlerFunction · 0.92
withGlobalEffectCtxFunction · 0.85

Tested by

no test coverage detected