fix(sidebar): live category change uses enclave-keyed nav fragment (LC-331) #342
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lc-331-sidebar-categories-live"
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?
What
Fix the WS handler for
ChatEvent::SidebarCategoriesChangedso live sidebar category updates render the enclave-keyed nav fragment instead of the whole-sidebar DM-only shape.Why
render_sidebarhardcodescurrent_enclave = None, producing the DM-only Home shape (no categories, no enclave rooms), and the category-change arm OOB-swapped that over#sidebar. For a member viewing the enclave this caused two bugs (LC-331): adding or deleting a category blanked the chat list until a manual refresh, and moving a chat into a category reverted a couple seconds later when the broadcast landed (the DB write viaset_room_positions/assign_roomupsert persists correctly; only the live render was wrong).Fix
Route the event through the existing LC-174
render_enclave_sidebar_nav(state, viewer, enclave_id), which renders#sidebar-nav-{enclave_id}viaload_sidebar(.., Some(enclave_id)). The id-keyed target is self-limiting: a connection on Home, a different enclave, or a stale subscription lacks the target and htmx drops the swap. No template, DB, or client-JS change.render_sidebaris retained for its remaining DM-creation / mute callers.Test
just testandjust test-saasboth green;just fmtclean. Manual: add/delete a category and drag a chat across categories while viewing an enclave; the list updates in place and the move sticks.#LC-331
The WS handler for `SidebarCategoriesChanged` rendered the whole-sidebar DM-only shape via `render_sidebar` (which hardcodes `current_enclave = None`) and OOB-swapped it over `#sidebar`. The DM-only shape has no categories and no enclave rooms, so for a member viewing the enclave the live broadcast blanked the chat list on category add/delete, and reverted a just-completed chat-move a beat after the correct PATCH response (the DB write persists; only the live render was wrong). Route the event through the existing LC-174 `render_enclave_sidebar_nav`, which renders the enclave-keyed `#sidebar-nav-{enclave_id}` fragment with `load_sidebar(.., Some(enclave_id))`. The id-keyed target is self-limiting: connections on Home, a different enclave, or a stale subscription drop the swap. #LC-331 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>