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 5b408a7
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(web): chat media and markdown widgets attach through ref callbacks
Rich chat content (Markdown code blocks and tables, Mermaid diagrams, HTML
renders, MCP apps, the expanded image dialog, zoomable images, HEIC
attachments, Pierre file icons) wired its DOM listeners, observers, and
copy timers through effects that mirrored refs and state. Two bugs rode
along: a window capture-phase Escape listener closed the expanded image
dialog even when a popup inside it was open, and Markdown copy silently
did nothing where navigator.clipboard is missing (plain-http LAN and
tailnet origins).
- ExpandedImageDialog: Escape goes through Base UI's onOpenChange, so a
nested popup closes first; opener focus is restored in the close
handler; blob URLs are revoked by the setter that replaces them.
- Chat overlays (ExpandedImageDialog, ChatOverlayHosts) are dropped by a
router onResolved listener started in appInit instead of per-host
unmount effects.
- MarkdownCodeBlock and MarkdownTable copy through useCopyToClipboard,
which has the execCommand fallback; the table measures clipping from a
ref callback with a MutationObserver plus ResizeObserver.
- ZoomableImage reads the viewer size through useSyncExternalStore and
anchors zoom with flushSync in the handler.
- McpAppFrame reads the tool definition through a query atom (adds
mcpAppEnvironment.toolInfoQuery), adopts a long-lived asset URL during
render, and owns full screen through the popover's toggle event and a
chrome ref callback.
- MermaidDiagram, HtmlRenderFrame, PierreEntryIcon mount or observe from
ref callbacks or module load. AttachmentImage starts its decode from the
img error handler.
Effects kept: HtmlRenderFrame full-screen pin release (component
lifetime), MarkdownCodeBlock incremental highlighter disposal, two in
McpAppFrame, AttachmentImage decode abort and blob URL revoke on unmount.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
0 commit comments