Skip to content

1.0.76

Choose a tag to compare

@morapelker morapelker released this 25 Mar 14:39
· 2411 commits to main since this release

What's Changed

Fix session rendering performance for very long sessions (#182)

Addresses UI lag in sessions with many messages by memoizing session components and stabilizing callback references.

  • Memoized 10 session components with React.memo: AssistantCanvas, CodeBlock, CompactionPill, CopyMessageButton, ForkMessageButton, MarkdownRenderer, MessageRenderer, ReasoningBlock, SubtaskCard, UserBubble — prevents unnecessary re-renders when parent state changes but individual message props haven't changed
  • Hoisted remarkPlugins array in MarkdownRenderer to module scope (remarkPluginsConfig) so React.memo shallow comparison works correctly (previously a new [remarkGfm] array was created every render, defeating memoization)
  • Stabilized fork handler in SessionView by replacing direct messages dependency with a messagesRef — prevents the useCallback from being recreated on every new message, which previously caused all MessageRenderer components (and their children) to receive a new onFork prop and re-render

Fix git changes tab auto-refresh race condition and watcher lifecycle (#181)

Fixes the git changes tab failing to auto-refresh due to race conditions in the worktree watcher lifecycle and incorrect safety-net poll suppression.

Worktree watcher reference counting & race fix (worktree-watcher.ts)

  • Added reference counting (refCount) to WatcherEntry — when multiple consumers watch the same worktree path, the watcher is kept alive until all consumers unwatch. Previously, the first unwatchWorktree() call would tear down the watcher even if other consumers still relied on it.
  • Fixed race condition in unwatchWorktree() — the map entry is now deleted synchronously before the async watcher .close() calls. This prevents a concurrent watchWorktree() from seeing a stale entry via watchers.has(), returning early (thinking it's already watching), and then having the entry removed by the in-flight cleanup — leaving no watcher at all.
  • Reordered cleanup sequence — debounce timers are now cleared before the map deletion, preventing a timer from firing between delete and clearTimeout and emitting a spurious status event.
  • Forced refCount reset in cleanupWorktreeWatchers() — on shutdown, refCount is forced to 1 before calling unwatchWorktree() so all watchers are fully closed regardless of outstanding references.

Safety-net poll filtering (useWindowFocusRefresh.ts)

  • Scoped onStatusChanged to active worktree paths — the focus-refresh hook now only resets its "last event" timer when the incoming git status event matches one of the currently active worktree paths. Previously, a healthy watcher on worktree B would reset the timer, suppressing the safety-net poll for a broken watcher on worktree A.

Add auto-pull before worktree creation (#179)

  • Adds automatic pulling from origin before creating worktrees to ensure they start with the latest changes
  • Implements new autoPullBeforeWorktree setting (enabled by default) in Settings > General
  • Adds pullBaseBranch() method to git-service that gracefully handles pull operations
  • Shows loading toasts during pull operations and info toasts when commits are pulled
  • Returns pull info in worktree creation results for UI feedback

Virtualize git changes file lists for large repo performance (#178)

Virtualizes the file lists in ChangesView and GitStatusPanel using @tanstack/react-virtual, preventing the browser from choking when repositories contain 10,000+ changed/untracked files.

Key changes

  • ChangesView (file-tree): Replace .map() rendering of conflict/staged/modified/untracked file sections with a single flattened virtual list using useVirtualizer. Only visible rows get DOM nodes. Adds a discriminated union FlatChangeItem type for headers vs file rows, with ROW_HEIGHT and HEADER_HEIGHT hoisted to module-level constants. Restores visual group separators (border-t) lost during the refactor.
  • ChangesView — MemberChanges (connection mode): Replace three GroupHeader + .map() sections with a single virtualized flat list per member, matching the main ChangesView pattern. Each MemberChanges instance gets its own virtualizer with a 300px max-height scroll container. Removes the now-unused GroupHeader component.
  • GitStatusPanel: Replace .map() rendering across 4 CollapsibleSection groups with a single flat virtualized list. Same pattern: discriminated union FlatStatusItem, collapsed Set state, flatItems useMemo, and useVirtualizer with absolute positioning. FileItem is wrapped in memo() and the static statusColors map is hoisted to module scope to avoid re-creation on every render.
  • Tests: Updated changes-view.test.ts to match the new virtualized DOM structure.

Files changed

File Change
src/renderer/src/components/file-tree/ChangesView.tsx Virtualized main file list + MemberChanges
src/renderer/src/components/git/GitStatusPanel.tsx Virtualized file list + memo optimizations
test/phase-11/session-10/changes-view.test.ts Test adjustments for new structure

Remove auto-expand projects in connection mode (#177)

This PR removes the automatic expansion of all projects when entering connection mode, simplifying the UI behavior.

Changes

  • Removed expandAllProjects function from useProjectStore that was expanding all project IDs
  • Removed useEffect hook in LeftSidebar.tsx that triggered auto-expansion when connectionModeActive became true
  • Cleaned up type definitions by removing the expandAllProjects method from the store interface

Rationale

The auto-expand behavior was adding unnecessary complexity to connection mode. Users can manually expand projects as needed, giving them more control over the UI state.

Fix: Use preferred terminal setting for all Open in Terminal actions (#176)

  • Bug fix: The "Open in Terminal" actions for worktrees and connections were hardcoded to always launch Terminal.app (macOS) or cmd.exe (Windows), completely ignoring the user's preferred terminal configured in Settings
  • Refactor: Consolidated duplicated terminal-launch logic from three separate IPC handlers (connection-handlers.ts, worktree-handlers.ts, settings-handlers.ts) into a shared launchTerminal() helper function
  • New shared function: Added openPathWithPreferredTerminal() in settings-handlers.ts that reads the user's preferred terminal from the database and delegates to launchTerminal(), making it reusable across all handlers

Changes by file

src/main/ipc/settings-handlers.ts

  • Added launchTerminal(targetPath, terminalId, customCommand?) — centralized platform-specific terminal launch logic (macOS, Windows, Linux) with support for custom terminal commands
  • Added openPathWithPreferredTerminal(path) — reads defaultTerminal and customTerminalCommand from the app settings DB, then calls launchTerminal()
  • Simplified the existing settings:openWithTerminal IPC handler to delegate to launchTerminal() instead of containing its own copy of the logic

src/main/ipc/worktree-handlers.ts

  • Replaced ~65 lines of hardcoded terminal-launch logic in worktree:openInTerminal with a single call to openPathWithPreferredTerminal()
  • Removed unused spawn, platform imports

src/main/ipc/connection-handlers.ts

  • Replaced ~50 lines of hardcoded terminal-launch logic in connection:openInTerminal with a single call to openPathWithPreferredTerminal()
  • Removed unused spawn, existsSync, platform imports

Net impact

  • 3 files changed, 133 insertions, 208 deletions (net −75 lines)
  • Eliminates code duplication across three handlers
  • All "Open in Terminal" actions now respect the user's preferred terminal setting

Warn on merge/archive when source worktree has uncommitted changes (#175)

  • Dirty-check before merge and archive: When merging or archiving a branch that is checked out in a worktree with uncommitted changes, the user now sees a confirmation dialog listing the affected files with a diff stat (additions/deletions/binary) before proceeding.
  • New MergeConfirmDialog component: A new MergeConfirmDialog in src/renderer/src/components/worktrees/ shows uncommitted file changes with color-coded icons (added/deleted/modified) and stat counts, warning that these changes won't be included in the merge.
  • ArchiveConfirmDialog integration: The existing ArchiveConfirmDialog is now also used in GitPushPull to warn before archiving a worktree with dirty files.
  • GitPushPull refactored: The handleMerge and handleArchiveWorktree functions now first call window.gitOps.getDiffStat() to check for uncommitted changes; if dirty files exist, confirmation dialogs are shown before proceeding. The actual operations are extracted into doMerge and doArchiveWorktree helpers.