gitstack
closed

Duplicate `UpdateProps` emitted on receiver components that already implement it

#114
metrofun · 2026-07-10T21:34:43Z view on GitHub

For a method (receiver) template, the generator unconditionally emits an UpdateProps method after generating Render, even when the receiver type already declares one. Go then rejects the type with a duplicate-method error.

Environment

  • go-tui: v0.17.0

Minimal reproduction

package repro

import tui "github.com/grindlemire/go-tui"

type lifecycleRow struct {
    value string
}

func (r *lifecycleRow) UpdateProps(fresh tui.Component) {}

templ (r *lifecycleRow) Render() {
    <span>{r.value}</span>
}

Actual

Generation emits a second UpdateProps method, and Go rejects it:

method lifecycleRow.UpdateProps already declared

The generator calls generateUpdateProps unconditionally for method templates after generating Render, without honoring a user-owned method.

Expected

Receiver component types own their handwritten lifecycle methods; generated function-view types own generated lifecycle methods. The generator must not add a lifecycle method to a receiver that already implements the relevant runtime interface.

grindlemire grindlemire · 2026-07-10T16:27:46Z

Thanks for the report! I'll look into this.

grindlemire grindlemire · 2026-07-10T21:34:31Z

Fixed this. I'll cut a release so this is available in v0.18.2! Thanks!