File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ var buttonId string
5858
5959func Test1 (t * testing.T ) {
6060 log .Printf ("hello!\n " )
61- root := engine .MakeRoot ()
61+ root := engine .MakeRoot (nil )
6262 root .RegisterComponent ("Page" , Page )
6363 root .RegisterComponent ("Button" , Button )
6464 root .Render (vdom .H ("Page" , nil ), & engine.RenderOpts {Resync : false })
Original file line number Diff line number Diff line change @@ -54,13 +54,13 @@ type ClientImpl struct {
5454func makeClient () * ClientImpl {
5555 client := & ClientImpl {
5656 Lock : & sync.Mutex {},
57- Root : MakeRoot (),
5857 DoneCh : make (chan struct {}),
5958 SSEventCh : make (chan ssEvent , 100 ),
6059 UrlHandlerMux : http .NewServeMux (),
6160 ServerId : uuid .New ().String (),
6261 RootElem : vdom .H (DefaultComponentName , nil ),
6362 }
63+ client .Root = MakeRoot (client )
6464 return client
6565}
6666
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ type RootElem struct {
4343 Atoms map [string ]genAtom
4444 atomLock sync.Mutex
4545 RefOperations []vdom.VDomRefOperation
46+ Client * ClientImpl
4647}
4748
4849func (r * RootElem ) AddRenderWork (id string ) {
@@ -84,12 +85,13 @@ func (r *RootElem) GetConfigMap() map[string]any {
8485 return result
8586}
8687
87- func MakeRoot () * RootElem {
88+ func MakeRoot (client * ClientImpl ) * RootElem {
8889 return & RootElem {
8990 Root : nil ,
9091 CFuncs : make (map [string ]any ),
9192 CompMap : make (map [string ]* ComponentImpl ),
9293 Atoms : make (map [string ]genAtom ),
94+ Client : client ,
9395 }
9496}
9597
You can’t perform that action at this time.
0 commit comments