Skip to content

Commit 6b06f0d

Browse files
committed
debug: Add comprehensive logging to webgpu-cube initialization
Add detailed debug logging throughout the app initialization and rendering pipeline to diagnose E2E test failures: - Log each step of AppWithControls creation - Log Render method execution and VNode tree building - Log main.go initialization steps - Remove ID('app') from app.gx to fix duplicate ID issue This will help identify where the initialization is failing or hanging in the CI environment.
1 parent d2b0c5a commit 6b06f0d

3 files changed

Lines changed: 44 additions & 9 deletions

File tree

examples/webgpu-cube/app.gx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
func App() (Component) {
44
Div(
5-
ID("app"),
65
Class("webgpu-container"),
76
TabIndex(0)
87
) {

examples/webgpu-cube/app_custom.go

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
package main
44

5-
import "github.com/gaarutyunov/guix/pkg/runtime"
5+
import (
6+
"fmt"
7+
8+
"github.com/gaarutyunov/guix/pkg/runtime"
9+
)
610

711
// AppWithControls extends the generated App with Controls integration
812
type AppWithControls struct {
@@ -13,19 +17,27 @@ type AppWithControls struct {
1317

1418
// NewAppWithControls creates an App with integrated Controls
1519
func NewAppWithControls() *AppWithControls {
20+
fmt.Println("[Go] NewAppWithControls: Creating command channel...")
1621
commands := make(chan ControlCommand, 10)
1722

1823
// Start command processor goroutine
24+
fmt.Println("[Go] NewAppWithControls: Starting command processor...")
1925
go func() {
2026
for cmd := range commands {
2127
processControlCommand(cmd)
2228
}
2329
}()
2430

31+
fmt.Println("[Go] NewAppWithControls: Creating base App...")
32+
app := NewApp()
33+
fmt.Println("[Go] NewAppWithControls: Creating Controls...")
34+
controls := NewControls(WithCommands(commands))
35+
fmt.Println("[Go] NewAppWithControls: Done")
36+
2537
return &AppWithControls{
26-
App: NewApp(),
38+
App: app,
2739
commands: commands,
28-
controlsInstance: NewControls(WithCommands(commands)),
40+
controlsInstance: controls,
2941
}
3042
}
3143

@@ -39,18 +51,32 @@ func (a *AppWithControls) BindApp(app *runtime.App) {
3951

4052
// Render renders the full app with controls and event handlers
4153
func (a *AppWithControls) Render() *runtime.VNode {
42-
return runtime.Div(
54+
fmt.Println("[Go] AppWithControls.Render: Called")
55+
fmt.Println("[Go] AppWithControls.Render: Creating keyboard handler...")
56+
keyHandler := makeKeyboardHandler(a.commands)
57+
fmt.Println("[Go] AppWithControls.Render: Creating render callback...")
58+
renderCallback := makeRenderUpdateCallback()
59+
fmt.Println("[Go] AppWithControls.Render: Creating cube scene...")
60+
cubeScene := NewCubeScene(0, 0)
61+
fmt.Println("[Go] AppWithControls.Render: Rendering controls...")
62+
controlsVNode := a.controlsInstance.Render()
63+
fmt.Println("[Go] AppWithControls.Render: Building VNode tree...")
64+
65+
result := runtime.Div(
4366
runtime.Class("webgpu-container"),
4467
runtime.TabIndex(0),
45-
runtime.OnKeyDown(makeKeyboardHandler(a.commands)),
68+
runtime.OnKeyDown(keyHandler),
4669
runtime.Canvas(
4770
runtime.ID("webgpu-canvas"),
4871
runtime.Width(600),
4972
runtime.Height(400),
50-
runtime.GPURenderUpdate(makeRenderUpdateCallback()),
51-
runtime.GPUScene(NewCubeScene(0, 0)),
73+
runtime.GPURenderUpdate(renderCallback),
74+
runtime.GPUScene(cubeScene),
5275
),
53-
a.controlsInstance.Render(),
76+
controlsVNode,
5477
runtime.Div(runtime.Class("loading"), runtime.Text("Loading WebGPU...")),
5578
)
79+
80+
fmt.Println("[Go] AppWithControls.Render: Done, returning VNode")
81+
return result
5682
}

examples/webgpu-cube/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,21 @@ func main() {
1717
fmt.Println("[Go] DOM is ready, initializing app")
1818

1919
// Create and mount app component with controls
20+
fmt.Println("[Go] Creating AppWithControls...")
2021
appComponent := NewAppWithControls()
22+
fmt.Println("[Go] AppWithControls created")
23+
24+
fmt.Println("[Go] Creating runtime app...")
2125
runtimeApp := runtime.NewApp(appComponent)
26+
fmt.Println("[Go] Runtime app created")
27+
28+
fmt.Println("[Go] Binding app...")
2229
appComponent.BindApp(runtimeApp)
30+
fmt.Println("[Go] App bound")
2331

32+
fmt.Println("[Go] Mounting to #app...")
2433
if err := runtimeApp.Mount("#app"); err != nil {
34+
fmt.Println("[Go] Mount error:", err)
2535
panic(err)
2636
}
2737

0 commit comments

Comments
 (0)