Skip to content
Gx
GitHub

GX4006: signal or client expression under an adapter with no signals

The app uses the htmx adapter, and a template declares a signal or holds a client expression.

Cause

The gx.toml of the app names the htmx adapter. htmx has no client signals. A template of the app declares a signal, holds a client expression, or uses an event modifier that htmx does not have.

An on: handler that is one route value is not a client expression. It works with each adapter.

Example

gx.toml
adapter = "htmx"
cart/Cart.gx
package cart

signals {
  Open bool = false
}

<section>
  <button on:click={$Open = !$Open}>Details</button>
  <p show={$Open}>The cart is empty.</p>
</section>

gx check reports:

gx check
cart/Cart.gx:4:3: GX4006: the htmx adapter has no signals: this component declares signal "Open"
cart/Cart.gx:8:11: GX4006: the htmx adapter has no signals: this on: handler holds signal statements
cart/Cart.gx:9:6: GX4006: the htmx adapter has no signals: the "show" directive is a client expression

Fix

  1. Keep the state on the server. Make an action that patches a fragment.
  2. Or use an island for state that must live in the browser.
  3. Or set adapter = "datastar" in gx.toml, and use the Datastar adapter in gx.Config.