0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00

fix(playground): animate memory panel resizing (#19337)

Opening Observational Memory details resized the shared agent panel to
50% immediately, which made the layout visibly jump.


https://github.com/user-attachments/assets/8ef2ba3d-ed68-4570-a1ce-f16cb53812f5

## Summary

- Add a shared `PanelGroup` that couples smooth programmatic resize
behavior with its colocated stylesheet.
- Animate panel width through `flex-grow` and `flex-basis`, keep
pointer-driven resizing immediate, and honor reduced-motion preferences
entirely in CSS.
- Use the panel width as the only content transition: collapsible
content stays mounted and clipped while the panel shrinks, then becomes
statically hidden at zero width.
- Remove the separate collapsible-content fade/slide state, custom event
subscriptions, `matchMedia` handling, mount-ready DOM mutation, and the
panel-resize `requestAnimationFrame`.
- Keep the transition rules loaded only by the `resize/panel-group`
package entry.
- Preserve the existing Observational Memory 50% expansion and
previous-width restoration behavior.

## Validation

- Playground UI typecheck and focused collapsible-panel tests
- Playground UI and Playground production builds
- Targeted ESLint and Prettier checks
- React Doctor: 100/100 for both changed packages
- Confirmed the transition selector is absent from global
`dist/style.css` and emitted only in `dist/panel-group.css`
- Real-browser verification: Observational Memory expands from 300px to
about 583px and restores to 300px; workflow content is progressively
clipped through the width transition and hidden only at zero; persisted
collapsed state does not flash; no console errors


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## ELI5

When opening Observational Memory details, the side panel now smoothly
grows instead of suddenly jumping to a new size. The change also
respects reduced-motion preferences and keeps existing resize and
restore behavior intact.

## Summary

- Added a shared `PanelGroup` with scoped CSS for smooth programmatic
panel resizing.
- Preserved immediate pointer-driven resizing and 50% Observational
Memory expansion/restoration.
- Honors `prefers-reduced-motion` and disables transitions during active
separator dragging.
- Simplified collapsible panel behavior by removing redundant
transition, mount, event, and animation-frame logic.
- Applied `PanelGroup` to agent, workflow, and topics layouts.
- Updated affected tests and added a patch changeset for
`@mastra/playground-ui`.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Damien Schneider 2026-07-13 16:00:23 +02:00 • committed by GitHub
commit 2d5c85612f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 65 additions and 127 deletions