You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: client _valid stuck false for any match: constraint (inverted regex call) #124
lib/lavash/form/validation_js.ex:231 emits ("pattern").match(value || '') — String.prototype.match invoked on the pattern string with the user's value as the regex. Result: the generated <form>_<field>_valid derive is permanently false whenever the Ash attribute has a match: constraint — for valid and invalid input alike.
The _errors generator at :303 gets it right (new RegExp(pattern).test(value)), and the server closure (expand_fields.ex, String.match?/2) is also correct — so client _valid disagrees with both.
Why it stayed hidden (same shape as the array-className bug in #122): _valid reaches the DOM mostly via data-lavash-enabled, which only disables — a stuck-false valid renders as "button stays greyed until the server round-trip", indistinguishable from latency. Nothing in demo/ uses a match: constraint, so no e2e ever exercised it.
Fix: new RegExp(pattern).test(value) at :231. Add the standing guard the audit suggests: a test with a match:-constrained form comparing server _valid, client _valid JS, and client _errors for agreement on valid AND invalid input.
Activity
fix: client _valid was permanently false for match: constraints (closes
feat!: consolidate form constraint validation on shared rx ASTs (closes