GX4003: no signal is declared for a signal-bound field
An action input has a field with a signal tag, and the component that invokes the action declares no signal with that name.
Cause
An action input has a field with a signal tag, and the component that invokes the action declares no signal with that name.
Example
package cart
import "app/cart/route"
<button on:click={route.Add{}}>Add</button>package cart
import (
"github.com/alternayte/gx"
"app/cart/route"
)
var Add = gx.Action(func(c *gx.Ctx, in route.Add) error { return nil })package route
import "github.com/alternayte/gx"
type Add struct {
gx.Route `POST /cart/add`
Qty int `signal:"qty"`
}
func (in *Add) Rules() gx.Rules {
return gx.Rules{gx.Field(&in.Qty, gx.Min(1))}
}gx check reports:
cart/Button.gx:5:9: GX4003: field "Qty" reads signal "qty" but this component declares no signal "qty"Fix
- Add the signal to the
signalsblock of the component. - Or remove the
signaltag when the value comes from a different source.