lloyAlloy on GitHub
alx.static_conditional_child
Docs

alx.static_conditional_child

alxwarn

Markup in a child expression that no function encloses: it is built once, not on each render.

-- reports: the branch runs once, at build time
return <Frame>{open and <Menu /> or nil}</Frame>

-- clean: a reactive library re-runs the function
return <Frame>{function() return if open then <Menu /> else nil end}</Frame>

A child expression is evaluated where the tag is built. A conditional child that names no function therefore keeps the value it had on the first render, and a later change to the condition shows nothing. Wrap it in a function, and the library that owns the tree calls it again.

[lint.rules] alx.static_conditional_child = "warn" sets the level: allow, warn, or deny. The markup compiler owns this lint, so the level reaches it through Config::markup.

Set its level in the [lint] table of alloy.toml, or for one file with --@alloy-lint.