(cfunc any, elem *VDomElem, comp **ComponentImpl)
| 405 | } |
| 406 | |
| 407 | func (r *RootElem) renderComponent(cfunc any, elem *VDomElem, comp **ComponentImpl) { |
| 408 | if (*comp).Children != nil { |
| 409 | for _, child := range (*comp).Children { |
| 410 | r.unmount(&child) |
| 411 | } |
| 412 | (*comp).Children = nil |
| 413 | } |
| 414 | props := make(map[string]any) |
| 415 | for k, v := range elem.Props { |
| 416 | props[k] = v |
| 417 | } |
| 418 | props[ChildrenPropKey] = elem.Children |
| 419 | ctx := r.makeRenderContext(*comp) |
| 420 | renderedElem := callCFunc(cfunc, ctx, props) |
| 421 | rtnElemArr := partToElems(renderedElem) |
| 422 | if len(rtnElemArr) == 0 { |
| 423 | r.unmount(&(*comp).Comp) |
| 424 | return |
| 425 | } |
| 426 | var rtnElem *VDomElem |
| 427 | if len(rtnElemArr) == 1 { |
| 428 | rtnElem = &rtnElemArr[0] |
| 429 | } else { |
| 430 | rtnElem = &VDomElem{Tag: FragmentTag, Children: rtnElemArr} |
| 431 | } |
| 432 | r.render(rtnElem, &(*comp).Comp) |
| 433 | } |
| 434 | |
| 435 | func (r *RootElem) UpdateRef(updateRef VDomRefUpdate) { |
| 436 | refId := updateRef.RefId |
no test coverage detected