fix(composer): reconcile a stuck send in place, not by reloading #messages (LC-382) #392
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lc-382-inplace-reconcile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #390 (LC-382). Reopens/continues the same bug.
Problem with the first fix
The watchdog in #390 reloaded the entire
#messagesregion (htmx.ajax(GET, location, {select:'#messages', swap:'outerHTML'})) when the optimistic placeholder was still pending. That recreates the scroll container and jumps it to the top of history - jarring, and arguably worse than the stuck placeholder.Better fix: in-place reconcile
post_messagenow returns the new message id in anX-LC-Message-Idresponse header (still204, no body).cidis still pending after the ~4s grace window (the WS broadcast was missed),__lcEchoReconcilefetches just that one message via the existingGET /messages/{id}(get_single_message, the per-viewer single-message fragment) and swaps it into the placeholder by id (target: #msg-pending-{cid},swap: outerHTML).Why it's safe
#msg-{id}) cannot happen past the grace window.__lcEchoDrop), or a failure flip (__lcEchoFailedcleareddata-lc-pending).Testing
./dev/cargo check,just test,just test-saas- all green.🤖 Generated with Claude Code