(work *EffectWorkElem, hook *Hook)
| 340 | } |
| 341 | |
| 342 | func (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 | |
| 365 | func (r *RootElem) runEffect(work *EffectWorkElem, hook *Hook) { |
| 366 | defer func() { |
no test coverage detected