Skip to content

Untangle presence's overlapping Turbo ownership with the broadcast-replaced #plan-header #161

Description

@HamptonMakes

Follow-up from #160.

#plan-viewers is rendered inside #plan-header, but two independent mechanisms replace overlapping DOM:

  • Plan broadcasts (Broadcaster.replace_to(plan, target: "plan-header", ...)) replace the whole header, including the viewers list.
  • The presence channel (plan_presence_channel.rb) independently replaces #plan-viewers on its ~15s cadence.

Problems this creates:

  1. Out-of-order replacement: a header broadcast and a presence broadcast can arrive in either order; whichever lands last wins. The presence fingerprint cache can then suppress a correcting update until membership actually changes.
  2. Lost viewer-relative styling: header broadcasts render with no current_user, so the "you" styling on the viewer's own avatar disappears after any header replacement, until the next presence tick repaints it.

Suggested direction: move the presence mount outside the header replacement boundary (a sibling of #plan-header rather than a child), so each Turbo target has exactly one owner. The header's meta row can reserve the slot; presence stays viewer-relative and self-managed.

Works correctly today in practice (presence self-heals within one tick) — this is about removing the ownership overlap before it grows another symptom.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions