golive icon indicating copy to clipboard operation
golive copied to clipboard

Click event not firing server side

Open kellabyte opened this issue 2 years ago • 1 comments

Hello! I'm new to GoLive but I'm really excited about this project! I've ran the examples and I've tried to create my own from the start to get familiar but I'm struggling to get a simple button click event to fire on the server side.

I have the following HTML:

<button go-live-click="HandleUp">+</button>

And on the server I have this but the Println() doesn't seem to fire.

func (t *Thermostat) HandleUp() {
	fmt.Println("UP")
	t.Temperature = 50
}

I would really appreciate any help!

kellabyte avatar Jul 20 '22 14:07 kellabyte

Hi! Thank you opening this issue! I had to iterate again and it took me a bit of time. One of the first things I would say for you to be aware of is that the component needs to have a single dom element at the root of the render. If this is not the problem, could you provide me with a repository with the reproduction?

brendonmatos avatar Jul 23 '22 01:07 brendonmatos

That was the issue! Thank you so much for replying. Is there any way golive could give me an informative error I could have discovered how to fix this myself? The silent brokenness I had no idea what I needed to fix.

kellabyte avatar Aug 16 '22 15:08 kellabyte

Surely the library could warn this at runtime. I've been working lately on a version to support composition and will already add this warning on first run

Thank you very much for the feedback!!

brendonmatos avatar Aug 17 '22 23:08 brendonmatos