Repository navigation
Fix sidebar tab live presentation invalidating equatable rows - #4690
austinywang wants to merge 13 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis refactor moves unread-count, latest-notification-text, and shortcut-hint UI from the parent ChangesSidebar row component refactoring
Possibly related PRs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (2 errors, 1 warning, 1 inconclusive)
✅ Passed checks (13 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR isolates live-updating sidebar elements into small child views (
Confidence Score: 5/5Safe to merge; the refactor correctly moves live-updating sidebar elements into small child views without introducing stale state or broken invariants. The core equatable boundary works correctly: notification and modifier-key changes now reach only the lightweight child views, not the heavy TabItemView body. The frozen shortcut-hint scoping is precise — only the context-menu target row re-evaluates when the freeze state changes. The notification text logic change (trim-before-empty check, title fallback) is an intentional improvement stated in the PR description. No observable-isolation mistakes, no blocking primitives, and no stale-state paths were introduced. No files require special attention. Important Files Changed
Reviews (10): Last reviewed commit: "fix: remove stale sidebar notification f..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Sources/ContentView.swift`:
- Around line 9585-9587: Trim the notification body before deciding whether to
use the title: compute a trimmedBody by calling trimmingCharacters(in:
.whitespacesAndNewlines) on notification.body, then set text to
trimmedBody.isEmpty ? notification.title : trimmedBody (and continue to trim the
final text as currently done). Update the logic around variables text/trimmed so
empty-but-whitespace bodies fall back to notification.title rather than
suppressing it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0cd53467-88ad-4f05-a770-41075f36a529
📒 Files selected for processing (1)
Sources/ContentView.swift
Resolved by 88dc4c4; CodeRabbit confirmed the inline trim comment as addressed and the latest CodeRabbit status is success.
…w-equatable # Conflicts: # Sources/ContentView.swift
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b9050c6. Configure here.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmuxTests/SidebarWorkspaceSnapshotRefreshPolicyTests.swift`:
- Around line 212-251: Add two unit tests exercising the inverted freeze
scenarios for
SidebarWorkspaceShortcutHintFreezePolicy.showsModifierShortcutHints: 1) create a
matching tabId SidebarTabItemPresentationSnapshot with
showsModifierShortcutHints = false and call showsModifierShortcutHints(tabId:
sameId, liveModifierPressed: true, frozenPresentation: frozen) and assert the
result is false; 2) call showsModifierShortcutHints(tabId: UUID(),
liveModifierPressed: false, frozenPresentation: nil) and assert the result is
false. Ensure test names reflect the behavior (e.g.,
testFrozenPresentationHidesShortcutHintWhenLiveWouldShow and
testNoFrozenPresentationHidesShortcutHintWhenLiveDoesNotShow).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 152e3db1-4d90-4d25-b9fa-8315c7620c8d
📒 Files selected for processing (2)
Sources/ContentView.swiftcmuxTests/SidebarWorkspaceSnapshotRefreshPolicyTests.swift
Resolved by a639798; the requested shortcut hint freeze false-case tests were added and CodeRabbit marked the thread addressed, with latest CodeRabbit status success.
…w-equatable # Conflicts: # Sources/ContentView.swift # cmuxTests/SidebarWorkspaceSnapshotRefreshPolicyTests.swift

Summary
TabItemViewequality inputs so.equatable()protects the static row body.Fixes #4618
Testing
xcodebuild, and no./scripts/reload.sh..equatable()body-invalidation boundary and there is no clean runtime harness in this repo to assert body evaluation without source-shape tests or UI launches.HQ build command
CMUX_SKIP_ZIG_BUILD=1 ./scripts/reload.sh --tag issue-4618-tabitemview-equatable --launchNeed help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.Note
Medium Risk
Touches high-traffic sidebar rendering and notification/shortcut presentation; behavior should match prior UI but equatable boundaries can hide stale state if miswired.
Overview
Fixes sidebar performance (#4618) by keeping
TabItemView’s.equatable()boundary on mostly static row data while live UI still updates in small child views.Unread badges, notification/conversation subtitles, SSH remote lines, close button, and workspace shortcut hints are split into
SidebarWorkspaceUnreadBadge,SidebarWorkspaceLiveDetails,SidebarWorkspaceTrailingAccessory, andSidebarWorkspaceShortcutHintOverlay, each observingTerminalNotificationStoreormodifierKeyMonitorlocally. The parent no longer precomputesunreadCount,latestNotificationText, orshowsModifierShortcutHintsfor equality; it passesfrozenShortcutHintsTabId/frozenShortcutHintsValueper row instead.Context-menu shortcut-hint freeze now snapshots the live modifier state on menu appear (not a pre-resolved bool).
sidebarLatestNotificationTextcentralizes subtitle text with trimmed body, then title fallback.Reviewed by Cursor Bugbot for commit a8ef325. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fixes #4618 by isolating live sidebar tab UI into small observing views and freezing only shortcut-hint state during context menus so
.equatable()rows avoid full re-renders. Typing is smoother; unread badges, notification subtitles (MainActor-trimmed with body→title fallback), SSH status, and close/shortcut accessories update live.Bug Fixes
.equatable()rows stable by moving unread badge, latest-notification/conversation subtitle, remote status, and trailing close/shortcut UI into observing child views; shortcut hint now draws via an overlay that doesn’t affect layout.modifierKeyMonitor.isModifierPressedon appear and scoping frozen tab/value to the active row.Refactors
SidebarWorkspaceUnreadBadge,SidebarWorkspaceLiveDetails,SidebarWorkspaceTrailingAccessory, andSidebarWorkspaceShortcutHintOverlay; passmodifierKeyMonitorintoTabItemView; removed live values from equality and includedfrozenShortcutHintsTabId/frozenShortcutHintsValue.sidebarLatestNotificationText(MainActor-trimmed with body→title fallback) and removed the stale sidebar notification flag; now resolves visibility viasettings.showsNotificationMessage.Written for commit a8ef325. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Refactor