Skip to content

Dev Tools: Show what a slot update changed, and where - #2277

Merged
marcoroth merged 1 commit into
slots/collectionsfrom
slots/dev-tools
Aug 18, 2026
Merged

Dev Tools: Show what a slot update changed, and where#2277
marcoroth merged 1 commit into
slots/collectionsfrom
slots/dev-tools

Conversation

@marcoroth

@marcoroth marcoroth commented Aug 18, 2026

Copy link
Copy Markdown
Owner

This pull request announces every write the slot index makes, and draws it in the browser.

document.addEventListener("herb:slot-update", (event) => event.detail)
// { file, occurrence, index, operation, key, slot, row }

The event carries the slot and not a rectangle, because measuring costs a layout and only a listener knows whether it wants one. Dev Tools uses it to flash what changed, coloured by operation, labelled with the file, the index, the row key and, for an attribute slot, which attribute was written. An element can carry several, and an attribute is the hardest kind of slot to tell apart by looking at the page, since nothing about a class or an id changing is visible in the way text changing is.

Four fixes came out of using it.

A removal was announced after the row had gone, so there was nothing left to measure and nothing to draw a box around, and it reported the collection instead of the row. Removing the only row made both faults visible at once. The event carries the row now, and is said before the row is taken out.

A slot given the value it already has is left alone. Writing it would cost a re-parse, destroy whatever the slot contained, and announce a change that did not happen, so a payload matching the page reports { applied: 0, deferred: [] } and touches nothing.

class="card <%= state %>" marks the interpolated word while setAttribute writes the whole attribute, so applying the value dropped the card the template wrote beside it. A demo put its whole footer on one line the first time its layout was updated. A marker says which attribute a slot is, not which stretch of it, so refusing and saying so is the only honest answer until a marker carries the statics around the value.

And the last row out of a collection leaves its shape behind. The server parks a row only for a collection that rendered empty, so emptying one in the browser left neither a row to copy nor a parked one, and a table with one row in it deleted is two clicks away from needing another.

CleanShot.2026-08-17.at.03.52.35.mp4

@github-actions github-actions Bot added typescript TypeScript source across the javascript/ packages dev-tools @herb-tools/dev-tools visual debugging for HTML+ERB templates labels Aug 18, 2026
@marcoroth marcoroth added the reactivity Reactive ERB templates: diff and re-render only what changed label Aug 18, 2026
@nx-cloud

nx-cloud Bot commented Aug 18, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit cb36434

Command Status Duration Result
nx run-many -t test --all --parallel --exclude=... ✅ Succeeded 2m 58s View ↗
nx run-many -t build --all --exclude=herb-langu... ✅ Succeeded 18s View ↗
nx build @herb-tools/tailwind-class-sorter ✅ Succeeded 1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-08-18 03:12:48 UTC

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

🌿 Interactive Playground and Documentation Preview

A preview deployment has been built for this pull request. Try out the changes live in the interactive playground:


🌱 Grown from commit 386ab90


✅ Preview deployment has been cleaned up.

@pkg-pr-new

pkg-pr-new Bot commented Aug 18, 2026

Copy link
Copy Markdown
npx https://pkg.pr.new/@herb-tools/formatter@2277
npx https://pkg.pr.new/@herb-tools/language-server@2277
npx https://pkg.pr.new/@herb-tools/linter@2277

commit: 386ab90

@marcoroth marcoroth added the client-runtime Browser runtime for the Herb slots. label Aug 18, 2026
@marcoroth
marcoroth merged commit dfdcdf7 into main Aug 18, 2026
30 of 31 checks passed
@marcoroth
marcoroth deleted the slots/dev-tools branch August 18, 2026 12:42
marcoroth added a commit that referenced this pull request Aug 19, 2026
This pull request fixes the slot flash in the dev tools overlay which
were added in #2277.

Both `cssText` strings in `SlotFlash` were written without `;` between
the declarations, so each one reads as a single malformed declaration
and the browser keeps none of it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client-runtime Browser runtime for the Herb slots. dev-tools @herb-tools/dev-tools visual debugging for HTML+ERB templates reactivity Reactive ERB templates: diff and re-render only what changed typescript TypeScript source across the javascript/ packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant