Skip to content

feat(mcp-server): make Recent Activity rows collapsible by default - #57

Merged
Winlifes merged 4 commits into
FunplayAI:mainfrom
dehuaichendragonplus:feature/recent-activity-collapsible
Sep 7, 2026
Merged

Winlifes merged 4 commits into
FunplayAI:mainfrom
dehuaichendragonplus:feature/recent-activity-collapsible

Conversation

@dehuaichendragonplus

Copy link
Copy Markdown
Contributor

Why

The MCP Server window's Recent Activity panel rendered every row's full
structured result (or embedded screenshot) at all times. On a busy session
with dozens of tool calls this had two costs:

  • Performance: each fully-expanded card carries its own parsed JSON tree
    of colored key/value Labels (or a decoded screenshot Image), so a long
    session accumulates dozens of these live UI subtrees at once. Layout and
    repaint of the panel became noticeably sluggish as the list grew.
  • Signal-to-noise: with every row always fully expanded, the one entry a
    user actually wanted to check was buried under a wall of detail from
    unrelated calls, making the panel hard to scan.

What changed

  • Collapsed by default, click to expand: each row now shows a one-line
    summary by default. Clicking the header row or the summary line expands
    it in place (both are wired up since they are sibling elements, not nested).
  • Latest entry auto-expands, but manual state always wins: the most
    recently added row still expands automatically so the newest result is
    visible without an extra click. A small per-row RowExpandState tracks
    whether a user has manually toggled a row; when a new entry becomes the
    latest, the previously auto-expanded row collapses back unless the user
    touched it themselves in the meantime -- manual choices are never
    overridden by the "latest" auto-expand behavior, and any row a user
    expanded (auto-latest or not) stays expanded across future entries.
  • Summary width now tracks the panel, in both directions: the one-line
    summary previously used a fixed character cap before appending an ellipsis,
    which either truncated it well short of the available width or couldn't
    grow when the window was widened. It now relies on the default
    stretch-to-parent cross-axis sizing (matching how the header row already
    behaves) with minWidth = 0 so the NoWrap text's intrinsic width can't
    fight a relayout in either direction, and lets CSS TextOverflow.Ellipsis
    clip it at whatever the row's real width is on every relayout.
  • Consistent, formatted hover tooltip: hovering a row (header or summary
    line) shows the same formatted, multi-line detail text the expanded view
    renders. A plain card.tooltip assignment isn't enough: an ellipsis-
    truncated Label supplies its own default tooltip (its raw, unformatted
    text) the moment it's hovered, which pre-empts an ancestor's tooltip and
    made the header and the summary line show different content. This
    intercepts the TooltipEvent during the trickle-down (capture) phase on
    the card, before it reaches any child, so the same formatted value always
    wins regardless of which part of the row is hovered.

Validation

  • request_recompile / get_compilation_errors: no errors.
  • Verified via execute_code reflection against the live VisualElement
    tree of an open MCP Server window (not just visual screenshots):
    • resolvedStyle.display for each row's details container confirms
      collapsed-by-default and toggles correctly on a simulated ClickEvent
      sent to both the header row and the summary line.
    • Resizing the window narrow (450px) then wide (1200px) and re-measuring
      resolvedStyle.width on the summary Label confirms it shrinks and
      grows back to match the card's actual width.
    • Manually expanding an older row, then adding a new entry, confirms the
      previous auto-expanded ("latest") row collapses while the manually
      expanded row and the new latest row both stay/become expanded.
    • Dispatching a real TooltipEvent to the header, an inner header Label,
      and the summary Label of several rows confirms all three now resolve
      to the exact same formatted tooltip text.

CHANGELOG.md updated under [Unreleased].

dehuaichendragonplus and others added 4 commits September 7, 2026 11:06
Every row in the MCP Server window's Recent Activity panel previously
rendered its full structured result (or embedded screenshot) at all
times. On a busy session with dozens of tool calls this made the
panel noticeably slower to lay out/repaint, and buried the one entry
a user actually cared about under a wall of unrelated detail.

- Collapse each row to a one-line summary by default; clicking the
  header row or the summary line expands/collapses it in place.
- The most recently added row still auto-expands so the latest
  result stays visible without an extra click, but any row a user
  has manually expanded or collapsed keeps that state as newer
  entries arrive (only the automatic "latest" expansion is ever
  superseded, and only if the user hasn't touched that row).
- The summary line now stretches to the panel's actual width on
  every relayout (grows back on widen, shrinks on narrow) instead of
  a fixed character cap that either truncated it short of the
  available space or couldn't grow into a wider window.
- Hovering a row (header or summary line) shows the same formatted,
  multi-line detail text the expanded view renders. This intercepts
  the TooltipEvent during the trickle-down phase before Unity's
  default per-Label ellipsis tooltip -- which shows raw, unformatted
  text and could disagree with what the header showed -- gets a
  chance to supply it.
Create detail controls and screenshot textures on expansion; release them on collapse, clear, eviction, and disposal. Preserve manual expansion choices and invalidate queued callbacks after clear or rebuild.

Use formatted display text for summaries, retain the bounded longer plain-text display, and add 12 interactive Editor UI regression cases. Verified in Unity 2022.3.62f3c1: 34 focused tests passed; full EditMode suite 410 passed, 0 failed, 10 skipped.
@Winlifes
Winlifes merged commit 6437462 into FunplayAI:main Sep 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants