(ctx context.Context, feUpdate vdom.VDomFrontendUpdate)
| 23 | func (*WaveAppServerImpl) WshServerImpl() {} |
| 24 | |
| 25 | func (impl *WaveAppServerImpl) VDomRenderCommand(ctx context.Context, feUpdate vdom.VDomFrontendUpdate) chan wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate] { |
| 26 | respChan := make(chan wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate], 5) |
| 27 | defer func() { |
| 28 | panicErr := panichandler.PanicHandler("VDomRenderCommand", recover()) |
| 29 | if panicErr != nil { |
| 30 | respChan <- wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate]{ |
| 31 | Error: panicErr, |
| 32 | } |
| 33 | close(respChan) |
| 34 | } |
| 35 | }() |
| 36 | |
| 37 | if feUpdate.Dispose { |
| 38 | defer close(respChan) |
| 39 | log.Printf("got dispose from frontend\n") |
| 40 | impl.Client.doShutdown("got dispose from frontend") |
| 41 | return respChan |
| 42 | } |
| 43 | |
| 44 | if impl.Client.GetIsDone() { |
| 45 | close(respChan) |
| 46 | return respChan |
| 47 | } |
| 48 | |
| 49 | impl.Client.Root.RenderTs = feUpdate.Ts |
| 50 | |
| 51 | // set atoms |
| 52 | for _, ss := range feUpdate.StateSync { |
| 53 | impl.Client.Root.SetAtomVal(ss.Atom, ss.Value, false) |
| 54 | } |
| 55 | // run events |
| 56 | for _, event := range feUpdate.Events { |
| 57 | if event.GlobalEventType != "" { |
| 58 | if impl.Client.GlobalEventHandler != nil { |
| 59 | impl.Client.GlobalEventHandler(impl.Client, event) |
| 60 | } |
| 61 | } else { |
| 62 | impl.Client.Root.Event(event.WaveId, event.EventType, event) |
| 63 | } |
| 64 | } |
| 65 | // update refs |
| 66 | for _, ref := range feUpdate.RefUpdates { |
| 67 | impl.Client.Root.UpdateRef(ref) |
| 68 | } |
| 69 | |
| 70 | var update *vdom.VDomBackendUpdate |
| 71 | var err error |
| 72 | |
| 73 | if feUpdate.Resync || true { |
| 74 | update, err = impl.Client.fullRender() |
| 75 | } else { |
| 76 | update, err = impl.Client.incrementalRender() |
| 77 | } |
| 78 | update.CreateTransferElems() |
| 79 | |
| 80 | if err != nil { |
| 81 | respChan <- wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate]{ |
| 82 | Error: err, |
nothing calls this directly
no test coverage detected