feat: custom commit messages#157
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a CommitPanel and Textarea UI, routes Footer/CommandPalette actions to open the panel via callbacks/events, and wires Sidebar to host the panel and handle commits. ChangesCustom commit message panel
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/layout/Sidebar.tsx (1)
437-446: ⚡ Quick winWrap the panel open/close handlers in
useCallback.
Footerismemo-wrapped, but the inlineonOpenCommit/onClosearrows are recreated on everySidebarrender, which defeatsFooter's memoization and also regeneratesCommitPanel's internaluseCallbacks (sinceonCloseis in their deps). Stable references avoid this.As per coding guidelines: "Use `useCallback` and `useMemo` for performance-critical paths".♻️ Stable handlers
const [commitPanelOpen, setCommitPanelOpen] = useState(false); + const openCommitPanel = useCallback(() => setCommitPanelOpen(true), []); + const closeCommitPanel = useCallback(() => setCommitPanelOpen(false), []);<CommitPanel open={commitPanelOpen} - onClose={() => setCommitPanelOpen(false)} + onClose={closeCommitPanel} /> {/* Footer with git status, commit, and settings */} <Footer onOpenSettings={onOpenSettings} - onOpenCommit={() => setCommitPanelOpen(true)} + onOpenCommit={openCommitPanel} />🤖 Prompt for 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. In `@src/components/layout/Sidebar.tsx` around lines 437 - 446, The inline arrow handlers passed to CommitPanel and the memoized Footer are recreated every render; wrap them in useCallback to provide stable references: create const handleCloseCommitPanel = useCallback(() => setCommitPanelOpen(false), []) and const handleOpenCommit = useCallback(() => setCommitPanelOpen(true), []) (or include any deps if you reference others), then pass handleCloseCommitPanel to CommitPanel's onClose and handleOpenCommit to Footer's onOpenCommit (keep onOpenSettings as-is if already stable); this preserves Footer memoization and prevents re-creating CommitPanel's internal callbacks.
🤖 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.
Nitpick comments:
In `@src/components/layout/Sidebar.tsx`:
- Around line 437-446: The inline arrow handlers passed to CommitPanel and the
memoized Footer are recreated every render; wrap them in useCallback to provide
stable references: create const handleCloseCommitPanel = useCallback(() =>
setCommitPanelOpen(false), []) and const handleOpenCommit = useCallback(() =>
setCommitPanelOpen(true), []) (or include any deps if you reference others),
then pass handleCloseCommitPanel to CommitPanel's onClose and handleOpenCommit
to Footer's onOpenCommit (keep onOpenSettings as-is if already stable); this
preserves Footer memoization and prevents re-creating CommitPanel's internal
callbacks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fa4ed644-d56a-451a-a83d-eb8d785834c5
📒 Files selected for processing (6)
src/components/command-palette/CommandPalette.tsxsrc/components/git/CommitPanel.tsxsrc/components/layout/Footer.tsxsrc/components/layout/Sidebar.tsxsrc/components/ui/Textarea.tsxsrc/components/ui/index.tsx
Summary
Adds support for custom git commit messages.
Previously, commits triggered from the footer and command palette always used a hardcoded message. This change introduces a shared commit panel that allows users to review and edit the commit message before committing.
Closes #154.
Changes
TextareacomponentTesting
Entercommits the messageShift+Enterinserts a newlineEscapecloses the panelScreenshots
Summary by CodeRabbit