You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3e65479
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(chat): clean up the deployed chat surface
Eight-angle cleanup pass over the full contents of the chat surface and
the speech code that survived the voice-mode removal.
Dead code
- enforceChatRateLimit: added for the TTS relay in #6212, orphaned when
#6215 deleted that route. Zero consumers.
- ChatToolCallStatus, ChatErrorType, and six unused CHAT_ERROR_MESSAGES
keys (only GENERIC_ERROR and CHAT_UNAVAILABLE are read).
- scrollToMessage was declared and destructured by ChatMessageContainer
but never used in its body; removing the prop also made the
scrollToShowOnlyMessage branch unreachable, since the sole caller
passed true.
- permissionState and the language prop on useSpeechToText: both
write-only across the repo.
- The image branch in ChatFileDownload's renderIcon returned the same
DefaultFileIcon at the same size as the fallback.
- chatKeys.status/detail: aliases of deploymentKeys nothing imported,
and misleading since they root under a different key namespace.
Redundant state
- password-auth and email-auth each kept a boolean in lockstep with
`errors.length > 0`; email-auth also validated on every keystroke and
then immediately hid the result.
- file-download tracked hover in state to drive one opacity class; now
group-hover. Verified emcn Button sets no `group` class of its own.
Memoization
- ChatMessageContainer's memo() could never bail: chat.tsx passes an
inline arrow for scrollToBottom and displayMessages is a fresh array.
Four of the five things that re-render ChatClient are its props
anyway, so the memo is dropped rather than propped up.
- ClientChatMessage keeps its memo — it blocks markdown re-parsing —
but loses the custom comparator, which compared proxies (a
key:status fingerprint, files by length) and ignored attachments and
type entirely. Default shallow compare on its single prop is both
simpler and stricter.
- Six useCallbacks whose consumers are native DOM handlers or inline
arrows, so nothing observed their identity.
Effects
- The scroll listener attached in an effect keyed on [chatConfig,
authRequired] — values it never reads, standing in for "the container
has mounted". It now attaches via a ref callback, so it no longer
re-attaches on every config refetch.
Design system and a11y
- z-[100] -> z-[var(--z-dropdown)] (same value), shadow-lg ->
shadow-medium, list styles from inline style to Tailwind classes,
hover: -> hover-hover: on touch-reachable targets, Check sourced from
emcn alongside its Duplicate pair.
- Accessible names on the remove-attachment, stop, and send buttons,
which announced only as "button".
- Dropped a keyboard handler on a role='group' div with no tabIndex,
where target === currentTarget was unreachable, and the Tooltip
Provider wrappers and delayDuration, which emcn documents as
no-op passthroughs.
0 commit comments