fix(composer): clear the live markdown overlay after send (LC-399) #415

Merged
longjacksonle merged 1 commit from fix/lc-399-overlay-stale-after-send into main 2026-06-20 22:56:31 +02:00

Bug

After sending a message, the live markdown overlay (LC-399, #414) kept showing the just-sent text behind the now-empty composer. Only a page reload cleared it.

Cause

The overlay re-rendered the .lc-mdback backdrop only on the textarea's input event. A successful send clears the box with ta.value = '' inside the form's hx-on::after-request handler, and assigning .value programmatically does not fire an input event, so the backdrop never re-rendered and held the stale HTML. The optimistic-echo Retry-restore path sets ta.value the same way and had the same gap.

Fix

Re-render the overlay on the form's htmx:afterRequest too. schedule() is rAF-coalesced, so the render runs on the next frame, after the inline clear (or restore) has executed - independent of listener registration order. The extra renders triggered by the draft PUT and the autocomplete htmx.ajax calls that also bubble to the form are harmless no-ops (they just re-read the current value).

Scope

Template-only: JS inside server/templates/room/composer.html. No Rust, CSS, or contract change.

Tests

just check, just test, and just test-saas all pass.

## Bug After sending a message, the live markdown overlay (LC-399, #414) kept showing the just-sent text behind the now-empty composer. Only a page reload cleared it. ## Cause The overlay re-rendered the `.lc-mdback` backdrop only on the textarea's `input` event. A successful send clears the box with `ta.value = ''` inside the form's `hx-on::after-request` handler, and assigning `.value` programmatically does not fire an `input` event, so the backdrop never re-rendered and held the stale HTML. The optimistic-echo Retry-restore path sets `ta.value` the same way and had the same gap. ## Fix Re-render the overlay on the form's `htmx:afterRequest` too. `schedule()` is rAF-coalesced, so the render runs on the next frame, after the inline clear (or restore) has executed - independent of listener registration order. The extra renders triggered by the draft PUT and the autocomplete `htmx.ajax` calls that also bubble to the form are harmless no-ops (they just re-read the current value). ## Scope Template-only: JS inside `server/templates/room/composer.html`. No Rust, CSS, or contract change. ## Tests `just check`, `just test`, and `just test-saas` all pass.
fix(composer): clear the live markdown overlay after send (LC-399)
All checks were successful
check-secrets / Kingfisher (push) Successful in 4s
check-secrets / TruffleHog (push) Successful in 4s
check-secrets / Nosey parker (push) Successful in 5s
check-secrets / Nosey parker (pull_request) Successful in 4s
check-secrets / Kingfisher (pull_request) Successful in 6s
check-secrets / TruffleHog (pull_request) Successful in 6s
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 3m15s
904fb0db8b
The LC-399 highlight overlay only re-rendered on the textarea's `input` event. A successful send clears the box with `ta.value = ''` in the form's hx-on::after-request handler, and a programmatic value change fires no `input` event, so the backdrop kept showing the just-sent text until a page reload. The Retry-restore path sets `ta.value` the same way.

Re-render the overlay on the form's `htmx:afterRequest` as well. `schedule()` is rAF-coalesced, so it reads the textarea after the inline clear (or restore) has run, independent of listener order. Extra renders on the draft PUT and autocomplete ajax that also bubble to the form are harmless no-ops.

Template-only (JS inside room/composer.html), no Rust change. just check, just test, just test-saas all pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
longjacksonle deleted branch fix/lc-399-overlay-stale-after-send 2026-06-20 22:56:31 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/lets-chat!415
No description provided.