Skip to content

fix: enhance session pinning behavior and update related tests - #1646

Merged
zerob13 merged 1 commit into
devfrom
fix-style
May 20, 2026
Merged

fix: enhance session pinning behavior and update related tests#1646
zerob13 merged 1 commit into
devfrom
fix-style

Conversation

@zhangmo8

@zhangmo8 zhangmo8 commented May 20, 2026

Copy link
Copy Markdown
Collaborator

fix pinning hero animation

Summary by CodeRabbit

Release Notes

Improvements

  • Refined animations when pinning and unpinning sessions with smoother visual transitions and better placeholder positioning
  • Improved session reordering in the sidebar to correctly reflect pin status changes
  • Session metadata now updates accurately when toggling pin status

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 08aab5d0-8a87-4554-9590-c9bf10f259d5

📥 Commits

Reviewing files that changed from the base of the PR and between 889c1d5 and 321188f.

📒 Files selected for processing (5)
  • src/renderer/src/components/WindowSideBar.vue
  • src/renderer/src/components/WindowSideBarSessionItem.vue
  • src/renderer/src/stores/ui/session.ts
  • test/renderer/components/WindowSideBar.test.ts
  • test/renderer/stores/sessionStore.test.ts

📝 Walkthrough

Walkthrough

Pin-flight animations now measure from a dedicated hero placeholder element that settles across animation frames rather than directly measuring the target. WindowSideBarSessionItem accepts a new heroPlaceholder prop; WindowSideBar passes it conditionally based on pinFlightSessionId. DOM helpers measure element positions, wait for placeholder stabilization, and generate dynamic keyframes based on pinned state. Session store now updates updatedAt timestamps during pin toggles to support ordering.

Changes

Pin-flight placeholder animation

Layer / File(s) Summary
Placeholder prop and rendering
src/renderer/src/components/WindowSideBarSessionItem.vue
heroPlaceholder optional prop added; root element gains data-pin-placeholder attribute derived from prop.
Placeholder types and animation constants
src/renderer/src/components/WindowSideBar.vue
New SessionItemRegion and SessionItemRect types, plus timing/tolerance constants (PIN_FLIGHT_DURATION_MS, settle-frame limits, pixel epsilon) for measurement and stabilization.
Placeholder prop passing from parent
src/renderer/src/components/WindowSideBar.vue
Pinned and grouped session items receive hero-placeholder prop conditional on pinFlightSessionId.
DOM measurement and placeholder settlement helpers
src/renderer/src/components/WindowSideBar.vue
New functions locate and measure session items/placeholders, compare bounding rects, wait asynchronously for placeholder stabilization across animation frames with fallback, and generate animation options/keyframes based on pinned state.
Updated animatePinFlight implementation
src/renderer/src/components/WindowSideBar.vue
animatePinFlight uses typed region values, retrieves target via placeholder settlement waiter instead of direct measurement, handles missing-target errors, and applies dynamically-generated keyframes and animation options instead of hardcoded values.
Session timestamp update on pin toggle
src/renderer/src/stores/ui/session.ts
toggleSessionPinned now captures and applies updatedAt timestamp to sessions list, bootstrapActiveSession, and activeSessionSummary alongside isPinned updates.
Test infrastructure and validation
test/renderer/components/WindowSideBar.test.ts, test/renderer/stores/sessionStore.test.ts
Added createDomRect helper, global stub cleanup in afterEach, sessionClient toggleSessionPinned mock, and test cases validating session reordering on pin/unpin with time-based grouping.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • ThinkInAIXYZ/deepchat#1391: Adds overall pin-flight animation and hero/placeholder state via heroHidden and data attributes; this PR builds on that foundation with placeholder-settling logic and dynamic keyframe generation.
  • ThinkInAIXYZ/deepchat#1473: Also modifies pin-flight animation in WindowSideBar and session state, but with focus on docked/overlay pin states (forcePinDocked, pinDockedSessionId) rather than placeholder-based measurement.

Poem

🐰 A placeholder waits and settles so,
Through animation frames it learns to flow.
The sessions dance to dynamic beats,
While timestamps mark their ordered seats! 🎬✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main changes: enhancing session pinning behavior (the core fix for pin-flight animation and state management) and updating related tests, which aligns with the substantial modifications across multiple files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-style

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zerob13
zerob13 merged commit 99e309b into dev May 20, 2026
3 checks passed
@zhangmo8
zhangmo8 deleted the fix-style branch May 20, 2026 23:37
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