(updateRef rpctypes.VDomRefUpdate)
| 416 | } |
| 417 | |
| 418 | func (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 | |
| 453 | func (r *RootElem) QueueRefOp(op vdom.VDomRefOperation) { |
| 454 | r.RefOperations = append(r.RefOperations, op) |
no outgoing calls
no test coverage detected