this will be called by the frontend to say the DOM has been mounted it will eventually send any updated "refs" to the backend as well
(opts *RenderOpts)
| 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 |
| 390 | func (r *RootElem) RunWork(opts *RenderOpts) { |
| 391 | workQueue := r.EffectWorkQueue |
| 392 | r.EffectWorkQueue = nil |
| 393 | // first, run effect cleanups |
| 394 | for _, work := range workQueue { |
| 395 | comp := r.CompMap[work.WaveId] |
| 396 | if comp == nil { |
| 397 | continue |
| 398 | } |
| 399 | hook := comp.Hooks[work.EffectIndex] |
| 400 | r.runEffectUnmount(work, hook) |
| 401 | } |
| 402 | // now run, new effects |
| 403 | for _, work := range workQueue { |
| 404 | comp := r.CompMap[work.WaveId] |
| 405 | if comp == nil { |
| 406 | continue |
| 407 | } |
| 408 | hook := comp.Hooks[work.EffectIndex] |
| 409 | r.runEffect(work, hook) |
| 410 | } |
| 411 | // now check if we need a render |
| 412 | renderIds := r.getAndClearRenderWork() |
| 413 | if len(renderIds) > 0 { |
| 414 | r.render(r.Root.Elem, &r.Root, "root", opts) |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | func (r *RootElem) UpdateRef(updateRef rpctypes.VDomRefUpdate) { |
| 419 | refId := updateRef.RefId |
no test coverage detected