feat(pinned): re-render bubble on pin/unpin so hover menu flips immediately #68

Merged
longjacksonle merged 2 commits from feat/pin-message into main 2026-05-11 14:36:57 +02:00

Previously the pin/unpin HTTP response returned only the OOB strip fragment, leaving the acting tab's message hover menu stuck on the stale label (Pin after pinning, Unpin after unpinning) until the next full page render. The WS broadcast to other tabs had the same gap.

Extract the repeated MessageView assembly into a shared load_message_view_for_viewer helper in routes/mod.rs. Both the HTTP handlers (post_pin, delete_pin) and the WS render_pin_event function now return the re-rendered bubble concatenated with the OOB strip fragment. The bubble uses oob=false in HTTP responses (HTMX uses the button's hx-target="#msg-{id}") and oob=true in WS broadcasts (silent no-op if the element is not in the DOM). Update the pin/unpin buttons in message.html to set hx-target and hx-swap="outerHTML", and add assertions in the route tests to verify the bubble and flipped button are present in the response.

Previously the pin/unpin HTTP response returned only the OOB strip fragment, leaving the acting tab's message hover menu stuck on the stale label (Pin after pinning, Unpin after unpinning) until the next full page render. The WS broadcast to other tabs had the same gap. Extract the repeated MessageView assembly into a shared `load_message_view_for_viewer` helper in `routes/mod.rs`. Both the HTTP handlers (`post_pin`, `delete_pin`) and the WS `render_pin_event` function now return the re-rendered bubble concatenated with the OOB strip fragment. The bubble uses `oob=false` in HTTP responses (HTMX uses the button's `hx-target="#msg-{id}"`) and `oob=true` in WS broadcasts (silent no-op if the element is not in the DOM). Update the pin/unpin buttons in `message.html` to set `hx-target` and `hx-swap="outerHTML"`, and add assertions in the route tests to verify the bubble and flipped button are present in the response.
Previously the pin/unpin HTTP response returned only the OOB strip fragment, leaving the acting tab's message hover menu stuck on the stale label (Pin after pinning, Unpin after unpinning) until the next full page render. The WS broadcast to other tabs had the same gap.

Extract the repeated MessageView assembly into a shared `load_message_view_for_viewer` helper in `routes/mod.rs`. Both the HTTP handlers (`post_pin`, `delete_pin`) and the WS `render_pin_event` function now return the re-rendered bubble concatenated with the OOB strip fragment. The bubble uses `oob=false` in HTTP responses (HTMX uses the button's `hx-target="#msg-{id}"`) and `oob=true` in WS broadcasts (silent no-op if the element is not in the DOM). Update the pin/unpin buttons in `message.html` to set `hx-target` and `hx-swap="outerHTML"`, and add assertions in the route tests to verify the bubble and flipped button are present in the response.
Merge branch 'main' into feat/pin-message
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 10s
a1aa74e2c7
longjacksonle deleted branch feat/pin-message 2026-05-11 14:36:57 +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!68
No description provided.