Repository navigation
feat(desktop): add default preset support for new terminals - #637
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis PR introduces default terminal preset functionality across the application. It adds TRPC endpoints to manage default presets, extends the TerminalPreset schema with an Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UI as PresetRow Component
participant Hook as useSetDefaultPreset
participant TRPC as TRPC Client
participant Server
participant Cache as React Query Cache
User->>UI: Click star toggle
UI->>Hook: Call setDefaultPreset.mutate({id})
Hook->>TRPC: Invoke setDefaultPreset mutation
TRPC->>Server: Send mutation request
Server->>Server: Update terminalPresets<br/>(set isDefault flags)
Server-->>TRPC: Return {success: true}
TRPC-->>Hook: Mutation succeeds
Hook->>Cache: Invalidate getTerminalPresets
Hook->>Cache: Invalidate getDefaultPreset
Cache-->>UI: Cache updated, re-render
UI-->>User: Star icon updates, UI reflects new default
sequenceDiagram
participant User
participant UI as Workspace UI
participant Hook as useTabsWithPresets
participant Presets as usePresets Hook
participant Store as Tabs Store
participant Tab as New Tab
User->>UI: Trigger "Add Tab" hotkey
UI->>Hook: Call addTab(workspaceId)
Hook->>Presets: Query defaultPreset data
Presets-->>Hook: Return default preset object
Hook->>Hook: Compute options from preset<br/>(initialCommands, initialCwd)
Hook->>Store: Call store.addTab with computed options
Store->>Tab: Create tab with preset options
Tab-->>Store: Tab created with preset settings
Store-->>Hook: Return
Hook-->>UI: New tab spawned with preset applied
UI-->>User: Terminal opens with preset config
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (13)
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 |
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
- Add isDefault field to TerminalPreset schema - Add setDefaultPreset mutation and getDefaultPreset query - Create useTabsWithPresets hook that applies default preset to new terminals - Add star toggle button in preset settings to mark/unmark default - Update all terminal creation entry points (Cmd+T, splits, plus button)
0659c19 to
57023ae
Compare
Summary
Changes
isDefaultfield to TerminalPreset schemasetDefaultPresetmutation andgetDefaultPresetquery to settings routeruseTabsWithPresetshook that wraps store actions with default preset supportSummary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.