Skip to content

fix: retire data-lavash-visible auto-injection — subtree derives own :if - #135

Merged
pinetops merged 1 commit into
mainfrom
fix/retire-visible-injection
Aug 22, 2026
Merged

pinetops merged 1 commit into
mainfrom
fix/retire-visible-injection

Conversation

@pinetops

Copy link
Copy Markdown
Member

Closes #127 — the final audit item.

Resolved by experiment, not by parameterizing

The issue asked what to do about the hardcoded "hidden" class. The answer turned out to be the specific-shadowing-general pattern a third time: :if={@bool} blocks over optimistic fields already ride subtree derives, which re-render client-side in BOTH directions — a class-based directive can't show an element :if removed from the DOM, so the injected data-lavash-visible only ever duplicated the hide direction. Deleting the injection and running the e2e proved it: the :if block still toggles both ways, unchanged.

What changed

  • Pattern-3 injection deleted (the last Tailwind assumption in the auto-injected surface goes with it)
  • data-lavash-visible stays as a manual annotation for non-lavash templates (JS unchanged) — same playbook as toggle
  • Docs state the full split: :if → subtree derives, hidden-class idiom → attribute derives, visible= → manual only
  • Unit tests flipped to pin the retirement; e2e renamed to describe the real mechanism

With this, all ten audit issues (#109–#118, #123–#129) are resolved. 922 root (incl. e2e) + 83 demo green; hook chain passed.

(For the record: landing this took eight hook runs — laptop suspend, a locked screen killing the focus tests deterministically, and CPU contention from parallel sessions. The flaky-under-load umbrella remains #42.)

🤖 Generated with Claude Code

…:if (closes #127)

Pattern 3 injected data-lavash-visible from :if={@Bool} — but those
blocks already ride subtree derives, which re-render client-side in
BOTH directions. A class-based directive can't show an element :if
removed from the DOM, so the injected attr only ever duplicated the
hide direction: dead weight, and the third instance of a specific
mechanism shadowing the general one. Proven by experiment: with the
injection deleted, the :if e2e toggles both directions unchanged.

This also retires the last Tailwind assumption ('hidden' class) from
the auto-injected surface. data-lavash-visible stays as a manual
annotation for non-lavash templates (JS unchanged); docs updated to
state the split: :if -> subtree derives, hidden-class idiom ->
attribute derives, visible= -> manual only.
@pinetops
pinetops merged commit 62e4034 into main Aug 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

consolidate later: data-lavash-visible hardcodes "hidden"

1 participant