Skip to content
Gx
GitHub

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

cart/Button.gx
package cart

import "app/cart/route"

<button on:click={route.Add{}}>Add</button>
cart/cart.go
package cart

import (
	"github.com/alternayte/gx"
	"app/cart/route"
)

var Add = gx.Action(func(c *gx.Ctx, in route.Add) error { return nil })
cart/route/route.go
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:

gx check
cart/Button.gx:5:9: GX4003: field "Qty" reads signal "qty" but this component declares no signal "qty"

Fix

  1. Add the signal to the signals block of the component.
  2. Or remove the signal tag when the value comes from a different source.