Skip to content

Commit

Permalink
fix component name getter for newer Go versions
Browse files Browse the repository at this point in the history
  • Loading branch information
yznts committed Jan 29, 2024
1 parent 969695a commit 3c2c97c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func Await(component any) any {
func ComponentName(component any) string {
funcpath := runtime.FuncForPC(reflect.ValueOf(component).Pointer()).Name()
tokens := strings.Split(funcpath, ".")
if tokens[len(tokens)-1] == "func1" || tokens[len(tokens)-1] == "func2" {
if strings.HasPrefix(tokens[len(tokens)-1], "func") {
return tokens[len(tokens)-2]
} else {
return tokens[len(tokens)-1]
Expand Down

0 comments on commit 3c2c97c

Please sign in to comment.