Skip to content

Preserve template hits when Alpine rebinds morphed attributes - #9

Merged
VitaliyBoyko merged 1 commit into
mainfrom
fix/coverage-after-alpine-rebind
Nov 24, 2026
Merged

VitaliyBoyko merged 1 commit into
mainfrom
fix/coverage-after-alpine-rebind

Conversation

@VitaliyBoyko

Copy link
Copy Markdown
Collaborator

Alpine runs its attribute handlers again after morphdom restores the original x-on:click expression. The coverage runtime previously instrumented only the initial tree walk. It now rewrites the attribute records Alpine is about to bind, so the rebind keeps its statement counter without adding another DOM mutation.

The regression morphs the existing button from the same instrumented server response before its first click. With 2.1.2 the handler ran once and recorded zero hits. With this change it runs once and records a hit against the specific x-on:click statement. The same markup remains interactive in a stock browser context. The served expression is increment in both cases.

Local validation passed 55 unit tests, 17 Playwright checks, 19 Cypress checks, TypeScript declarations, and npm pack --dry-run. Browser validation used Chrome for Testing 158.0.8127.36. Version 2.1.3 is prepared for the release workflow.

Addresses the collector finding in MageLens #104.

@VitaliyBoyko
VitaliyBoyko merged commit 5c95f0d into main Nov 24, 2026
5 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.

1 participant