Skip to content

Remove the unused typing map and the dead pin listener #273

Description

@HMarzban

Problem

The workspace broadcast listener carries state and a handler that do nothing.

The typing map has no reader. useBroadcastListener writes every typing event into workspaceSettings.typingIndicators through setTypingIndicator and removeTypingIndicator (apps/webapp/src/hooks/useBroadcastListener.ts:46-55, apps/webapp/src/stores/chat/workspaceSettingsStore.ts:8, :19-20, :30, :60-80). Nothing reads that map. The visible typing state comes from the same handler's updateUserStatus(..., 'TYPING') call, which feeds the avatar stacks.

An unused field sits next to it. workspaceSettings.activeChannelId (workspaceSettingsStore.ts:7) is never written or read. Its comment points at the typing map.

The pin handler has no sender. Nothing sends a pinnedMessage broadcast. The only send is commented out (apps/webapp/src/components/chatroom/components/MessageCard/hooks/usePinMessageHandler.ts:30-34). The pinner updates its own store directly. So the pin handler (useBroadcastListener.ts:36-45) never runs.

Acceptance criteria

  • The typing map, its two setters, its initial value, and the unused activeChannelId store field are removed.
  • When a second signed-in user types in the chat composer, their face shows the typing state. On desktop, it shows in the chat participants stack and in the TOC row stack, and clears after they stop.
  • The pinnedMessage listener and the commented-out send are removed.
  • bun run typecheck passes.

Agent Brief

Category: enhancement
Summary: Remove the unused typing map and the unused activeChannelId field, and remove the pin listener that has no sender.

Current behavior:
Typing events fill a map that nothing reads. A store field has no writer and no reader. A pinnedMessage listener waits for a broadcast that nothing sends.

Desired behavior:
Typing events only update user status. The dead field is gone. The pin listener and the commented-out send are gone.

Key interfaces:

  • useBroadcastListener(enabled) — mounted once in AppProviders.
  • setTypingIndicator and removeTypingIndicator — write the typing map.
  • updateUserStatus(userId, status) — writes the TYPING status that the avatar stacks read.
  • The commented-out pinnedMessage send in the pin handler hook.

Out of scope

Notes

The listener's cleanup does not detach its handlers. A code trace and a harness on 14ab7f9c1 show that this adds no second handler set today. At mount the channel does not exist yet, and a route change builds a new channel. Only a Fast Refresh edit in development can run the effect again on the same channel.

Activity

  1. added a commit that references this issue on Sep 22, 2026
    6e59004
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ChatRelated to chat featuresRefactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions