Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V8 - Nil reference issue with nested go-app components #559

Closed
aervin opened this issue Jul 7, 2021 · 3 comments
Closed

V8 - Nil reference issue with nested go-app components #559

aervin opened this issue Jul 7, 2021 · 3 comments

Comments

@aervin
Copy link

aervin commented Jul 7, 2021

Hoping there's a simple fix for this nil reference issue I'm experiencing during app.Compo.Update() calls.

Code that raises the error:

app.Div().ID(adminId).Body(
	app.Button().
            ID(adminId).
            Class("default").
            Style("min-width", "72px").
            Body(&CompIcon{Name: "far fa-trash-alt"}),
)

Code that makes things work:

app.Div().ID(adminId).Body(
	app.Button().
            ID(adminId).
            Class("default").
            Style("min-width", "72px").
            Body((&CompIcon{Name: "far fa-trash-alt"}).Render()),
)

Calling app.Compo.Render() explicitly seems to resolve the issue. But I'm wondering if this is expected or if there's an issue with how I'm composing my components.

TIA!

@aervin
Copy link
Author

aervin commented Jul 16, 2021

Ran into this again so thought I'd follow up with a traceback:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
wasm_exec.js:51 	panic: runtime error: invalid memory address or nil pointer dereference
wasm_exec.js:51 [signal 0xb code=0x0 addr=0x0 pc=0x0]
wasm_exec.js:51 
wasm_exec.js:51 goroutine 1 [running]:
wasm_exec.js:51 github.com/maxence-charriere/go-app/v8/pkg/app.RunWhenOnBrowser.func1()
wasm_exec.js:51 	/home/aaron/go/pkg/mod/github.com/maxence-charriere/go-app/v8@v8.0.0/pkg/app/app.go:103 +0x4
wasm_exec.js:51 panic(0x6fd40, 0x617980)
wasm_exec.js:51 	/snap/go/7954/src/runtime/panic.go:965 +0x19
wasm_exec.js:51 github.com/maxence-charriere/go-app/v8/pkg/app.(*Compo).Defer(0xaeac60, 0xb95d70)
wasm_exec.js:51 	/home/aaron/go/pkg/mod/github.com/maxence-charriere/go-app/v8@v8.0.0/pkg/app/component.go:177 +0xb
wasm_exec.js:51 github.com/maxence-charriere/go-app/v8/pkg/app.(*Compo).Update(0xaeac60)
wasm_exec.js:51 	/home/aaron/go/pkg/mod/github.com/maxence-charriere/go-app/v8@v8.0.0/pkg/app/component.go:189 +0x5
wasm_exec.js:51 main.(*CompCloudServiceDetails).OnUpdate2.func1()
wasm_exec.js:51 	/home/aaron/Desktop/tc-saas-backend/src-go/hq/src-wasm/comp-cloud-service-details.go:164 +0x4

@maxence-charriere
Copy link
Owner

maxence-charriere commented Jul 16, 2021

Thanks for reporting, I'll see what I can do.

@aervin
Copy link
Author

aervin commented Jul 16, 2021

Thanks! Please let me know if I need to provide more context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants