MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / UpdateRef

Method UpdateRef

tsunami/engine/rootelem.go:418–451  ·  view source on GitHub ↗
(updateRef rpctypes.VDomRefUpdate)

Source from the content-addressed store, hash-verified

416}
417
418func (r *RootElem) UpdateRef(updateRef rpctypes.VDomRefUpdate) {
419 refId := updateRef.RefId
420 split := strings.SplitN(refId, ":", 2)
421 if len(split) != 2 {
422 log.Printf("invalid ref id: %s\n", refId)
423 return
424 }
425 waveId := split[0]
426 hookIdx, err := strconv.Atoi(split[1])
427 if err != nil {
428 log.Printf("invalid ref id (bad hook idx): %s\n", refId)
429 return
430 }
431 comp := r.CompMap[waveId]
432 if comp == nil {
433 return
434 }
435 if hookIdx < 0 || hookIdx >= len(comp.Hooks) {
436 return
437 }
438 hook := comp.Hooks[hookIdx]
439 if hook == nil {
440 return
441 }
442 ref, ok := hook.Val.(*vdom.VDomRef)
443 if !ok {
444 return
445 }
446 ref.HasCurrent.Store(updateRef.HasCurrent)
447 ref.Position = updateRef.Position
448 if updateRef.TermSize != nil {
449 ref.TermSize = updateRef.TermSize
450 }
451}
452
453func (r *RootElem) QueueRefOp(op vdom.VDomRefOperation) {
454 r.RefOperations = append(r.RefOperations, op)

Callers 1

processFrontendUpdateMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected