wails
wails copied to clipboard
Bind panic
Description
Sorry guys, another issue) There is an issue about a go function's bind.
Here is a bind function
func (a *App) Bool(k string, v ...bool) (res bool) {
//...something here
}
here is a simple js call - its the right call of go function
Bool('key', true)
in Go I just ignore ...bool value but wails don't: panic: reflect: cannot use []bool as type bool in Call
To Reproduce
go
func (a *App) Bool(k string, v ...bool) (res bool) {
if v != nil{
return true
}
return false
}
js
let res = await Bool('key', true)
Expected behaviour
wails have to understand that bool is valid value for a go "...bool" slice
Screenshots
panic: reflect: cannot use []bool as type bool in Call
Attempted Fixes
No response
System Details
System
------
OS: MacOS
Version: 12.4
ID: 199506
Go Version: go1.18
Platform: darwin
Architecture: amd64
Wails
------
Version: v2.0.0-beta.38
Dependency Package Name Status Version
---------- ------------ ------ -------
xcode command line tools N/A Installed 2395
npm N/A Installed 8.11.0
*upx N/A Available
*nsis N/A Installed v3.08
* - Optional Dependency
Diagnosis
---------
Your system is ready for Wails development!
Optional package(s) installation details:
- upx : Available at https://upx.github.io/
If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
Additional context
No response
Thanks for reporting this. Just checking... If you name the function "Zool" does it still panic?
no no, it doest't matter whats the name of the function
if go function has a lazy slice param, wails have to understand it
There's a good chance we aren't handling varargs. If you get rid of the 3 dots, does it still panic?
no if I use simple []bool all is ok, just for lazy slices.
"lazy slices" I just call them that) ...some
https://wails.io/docs/guides/troubleshooting#cannot-call-backend-method-from-frontend-with-variadic-arguments
At the very least we should have a better error message
my bet sorry)
I mean, we shouldn't panic, but show a better message 🤣
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.