[PR #336] [CLOSED] fix(ui): prevent folder icon glitch during expand/collapse transition #4569

Closed
opened 2026-10-22 04:08:48 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/336
Author: @ghost
Created: 5/1/2026
Status: ❌ Closed

Base: main ← Head: chat_folder_transition_glitch


📝 Commits (2)

  • 34a3701 fix(ui): prevent folder icon glitch during expand/collapse transition
  • 464ba1a fix: small incision, drag handle click can collapse the folder.

📊 Changes

1 file changed (+86 additions, -72 deletions)

View changed files

📝 packages/client/src/components/layout/ChatSidebar.tsx (+86 -72)

📄 Description

Why this change

Fixed a visual glitch in the chat sidebar folder expand/collapse behavior. The folder header row (with rename/trash buttons and chevron) was being stretched and the action buttons jumped below their position before snapping back when a folder was expanded or collapsed. This was caused by framer-motion's Reorder.Item layout animations affecting the entire folder component (header + contents) instead of just the draggable header.

What changed

  • Refactored FolderRow component to separate concerns between drag-to-reorder and expand/collapse:
    • Reorder.Item now wraps only the folder header row (the draggable part)
    • Folder contents (chat entries) are rendered outside Reorder.Item as a plain conditional render
  • Added sliding transition animation for folder expand/collapse using AnimatePresence + motion.div:
    • Enter/exit animation: y: -8 → 0, opacity: 0 → 1, height: 0 → auto
    • Duration: 0.25s with easing [0.16, 1, 0.3, 1]
    • overflow-hidden on the container to clip content during height animation
  • Added mode="wait" to AnimatePresence to prevent exit animation from being interrupted when rapidly toggling a folder open/closed

Validation

  • pnpm check passes locally
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport)

Manual verification

  1. Open the chat sidebar
  2. Create or select a folder with multiple chat entries
  3. Expand/collapse the folder, verify the header row stays stable (no stretch/glitch)
  4. Verify the rename and delete buttons stay in place during toggle
  5. Drag folders to reorder, verify smooth drag animation still works
  6. Verify the sliding animation plays on expand (entries slide down) and collapse (entries slide up)
  7. Rapidly toggle a folder open/closed, verify no janky animation interruption

Docs and release impact

  • No docs changes needed

UI evidence (if applicable)

Before

https://github.com/user-attachments/assets/2bf0e762-8282-4e0c-b921-e0835599721d

After

https://github.com/user-attachments/assets/ab3b094f-1769-4d49-a226-ea8b904dd6ee

Summary by CodeRabbit

  • New Features
    • Added smooth animations and coordinated enter/exit transitions for expanding/collapsing folders in the chat sidebar, improving visual feedback.
  • Bug Fixes
    • Improved drag interaction so initiating a drag no longer accidentally toggles folder collapse, ensuring header clicks and collapse behavior remain reliable.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/336 **Author:** [@ghost](https://github.com/ghost) **Created:** 5/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `chat_folder_transition_glitch` --- ### 📝 Commits (2) - [`34a3701`](https://github.com/Pasta-Devs/Marinara-Engine/commit/34a37017a4e4d3a3686d4383c7ee4191aa972716) fix(ui): prevent folder icon glitch during expand/collapse transition - [`464ba1a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/464ba1aada1ee0488c09b8b1f8fb0afe606aced6) fix: small incision, drag handle click can collapse the folder. ### 📊 Changes **1 file changed** (+86 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/layout/ChatSidebar.tsx` (+86 -72) </details> ### 📄 Description ## Why this change Fixed a visual glitch in the chat sidebar folder expand/collapse behavior. The folder header row (with rename/trash buttons and chevron) was being stretched and the action buttons jumped below their position before snapping back when a folder was expanded or collapsed. This was caused by framer-motion's `Reorder.Item` layout animations affecting the entire folder component (header + contents) instead of just the draggable header. ## What changed - Refactored `FolderRow` component to separate concerns between drag-to-reorder and expand/collapse: - `Reorder.Item` now wraps only the folder header row (the draggable part) - Folder contents (chat entries) are rendered outside `Reorder.Item` as a plain conditional render - Added sliding transition animation for folder expand/collapse using `AnimatePresence` + `motion.div`: - Enter/exit animation: `y: -8 → 0`, `opacity: 0 → 1`, `height: 0 → auto` - Duration: `0.25s` with easing `[0.16, 1, 0.3, 1]` - `overflow-hidden` on the container to clip content during height animation - Added `mode="wait"` to `AnimatePresence` to prevent exit animation from being interrupted when rapidly toggling a folder open/closed ## Validation - [x] `pnpm check` passes locally - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport) ### Manual verification 1. Open the chat sidebar 2. Create or select a folder with multiple chat entries 3. Expand/collapse the folder, verify the header row stays stable (no stretch/glitch) 4. Verify the rename and delete buttons stay in place during toggle 5. Drag folders to reorder, verify smooth drag animation still works 6. Verify the sliding animation plays on expand (entries slide down) and collapse (entries slide up) 7. Rapidly toggle a folder open/closed, verify no janky animation interruption ## Docs and release impact - [x] No docs changes needed ## UI evidence (if applicable) ### Before https://github.com/user-attachments/assets/2bf0e762-8282-4e0c-b921-e0835599721d ### After https://github.com/user-attachments/assets/ab3b094f-1769-4d49-a226-ea8b904dd6ee <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added smooth animations and coordinated enter/exit transitions for expanding/collapsing folders in the chat sidebar, improving visual feedback. * **Bug Fixes** * Improved drag interaction so initiating a drag no longer accidentally toggles folder collapse, ensuring header clicks and collapse behavior remain reliable. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:08:48 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4569
No description provided.