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

Method runEffectUnmount

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

Source from the content-addressed store, hash-verified

340}
341
342func (r *RootElem) runEffectUnmount(work *EffectWorkElem, hook *Hook) {
343 defer func() {
344 comp := r.CompMap[work.WaveId]
345 compName := ""
346 if comp != nil {
347 compName = comp.ContainingComp
348 }
349 util.PanicHandler(fmt.Sprintf("UseEffect unmount - comp: %s", compName), recover())
350 }()
351 if hook.UnmountFn == nil {
352 return
353 }
354 effectCtx := &EffectContextImpl{
355 WorkElem: *work,
356 WorkType: "unmount",
357 Root: r,
358 }
359 withGlobalEffectCtx(effectCtx, func() any {
360 hook.UnmountFn()
361 return nil
362 })
363}
364
365func (r *RootElem) runEffect(work *EffectWorkElem, hook *Hook) {
366 defer func() {

Callers 1

RunWorkMethod · 0.95

Calls 2

PanicHandlerFunction · 0.92
withGlobalEffectCtxFunction · 0.85

Tested by

no test coverage detected