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

Method RunWork

pkg/vdom/vdom_root.go:228–258  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

226// this will be called by the frontend to say the DOM has been mounted
227// it will eventually send any updated "refs" to the backend as well
228func (r *RootElem) RunWork() {
229 workQueue := r.EffectWorkQueue
230 r.EffectWorkQueue = nil
231 // first, run effect cleanups
232 for _, work := range workQueue {
233 comp := r.CompMap[work.Id]
234 if comp == nil {
235 continue
236 }
237 hook := comp.Hooks[work.EffectIndex]
238 if hook.UnmountFn != nil {
239 hook.UnmountFn()
240 }
241 }
242 // now run, new effects
243 for _, work := range workQueue {
244 comp := r.CompMap[work.Id]
245 if comp == nil {
246 continue
247 }
248 hook := comp.Hooks[work.EffectIndex]
249 if hook.Fn != nil {
250 hook.UnmountFn = hook.Fn()
251 }
252 }
253 // now check if we need a render
254 if len(r.NeedsRenderMap) > 0 {
255 r.NeedsRenderMap = nil
256 r.render(r.Root.Elem, &r.Root)
257 }
258}
259
260func (r *RootElem) render(elem *VDomElem, comp **ComponentImpl) {
261 if elem == nil || elem.Tag == "" {

Callers 3

Test1Function · 0.45
fullRenderMethod · 0.45
incrementalRenderMethod · 0.45

Calls 1

renderMethod · 0.95

Tested by 1

Test1Function · 0.36