Skip to content

smooth like butter git commit history#9

Merged
anirudhisonline merged 2 commits into
mainfrom
git-butter
May 16, 2026
Merged

smooth like butter git commit history#9
anirudhisonline merged 2 commits into
mainfrom
git-butter

Conversation

@anirudhisonline
Copy link
Copy Markdown
Contributor

@anirudhisonline anirudhisonline commented May 15, 2026

Summary by CodeRabbit

  • Refactor

    • Commit diff view now shows all files in a single, continuous document with synchronized sidebar highlighting as you scroll.
    • Diff rows now include clear loading, error, binary, and empty placeholders for each file.
  • New Features

    • Diffs load lazily and are virtualized for smoother scrolling and improved performance.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 78157ca7-5e7d-4887-ac1b-c4f4f7470dac

📥 Commits

Reviewing files that changed from the base of the PR and between c4f0a69 and 235894e.

📒 Files selected for processing (1)
  • src/lib/components/workspace/CommitTab.svelte
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/components/workspace/CommitTab.svelte

📝 Walkthrough

Walkthrough

CommitTab.svelte refactored to render all commit files in one virtualized list rather than selecting and diff-ing a single file at a time. Files are loaded upfront, diffs fetched lazily with bounded concurrency, and the sidebar tracks the active file by viewport scroll position.

Changes

All-files virtualized diff display

Layer / File(s) Summary
State, lazy fetch queue, and virtualization model
src/lib/components/workspace/CommitTab.svelte (lines 6–258)
Script refactored to maintain files list and per-file diff state in fileDiffs store. Lazy fetch queue uses bounded concurrency (MAX_CONCURRENT=4) and generation-based cancellation to load diffs on visibility. Flattened allRows virtualization model combines file headers, loading/error/placeholder rows, hunks, and diff lines. Scroll handling updated to set activeFileIdx based on last visible file header.
Sidebar navigation and active file tracking
src/lib/components/workspace/CommitTab.svelte (lines 287–309)
Sidebar buttons now scroll the all-files document to the file header instead of selecting a single file. Buttons styled by activeFileIdx and call scrollToFile(fi) to navigate; sidebarEl binding keeps the active button in view.
All-files virtual document rendering
src/lib/components/workspace/CommitTab.svelte (lines 320–391)
Diff display replaced with a single all-files virtualized renderer. Per-row UI handles file headers (with added/removed counts), loading/error/binary/empty placeholders, and unified-style hunk/line rows. Removed prior unified vs. split pane branching and dependencies on selectedFile, diffResult, and diffMode.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through lines and headers bright,
Queued diffs to fetch by scroll and light,
One document now holds every file,
Lazy loads staggered, queued with style,
A tiny rabbit cheers this tidy sight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'smooth like butter git commit history' is vague and does not clearly describe the main technical change: a major refactor of CommitTab.svelte from single-file viewer to virtualized all-files document. Use a more descriptive title that explains the core change, such as 'Refactor CommitTab to virtualized all-files diff viewer with lazy loading' or 'Add virtualized file list with lazy diff loading to CommitTab'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch git-butter

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.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/lib/components/workspace/CommitTab.svelte (1)

235-240: ⚡ Quick win

Use non-animated sidebar syncing during scroll.

This effect runs frequently while scrolling the main pane; behavior: 'smooth' can cause animation churn. Keep smooth scrolling for explicit clicks, but use auto here.

Suggested tweak
-    if (btn) btn.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
+    if (btn) btn.scrollIntoView({ block: 'nearest', behavior: 'auto' });
🤖 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/lib/components/workspace/CommitTab.svelte` around lines 235 - 240, The
reactive effect that syncs the sidebar uses smooth scrolling which causes
animation churn when it runs frequently; in the $effect that reads activeFileIdx
and queries sidebarEl (button via `[data-fi="${fi}"]`) replace scrollIntoView({
block: 'nearest', behavior: 'smooth' }) with a non-animated call (e.g.,
scrollIntoView({ block: 'nearest', behavior: 'auto' })) so automatic syncing
uses instant scrolling while preserving smooth behavior for explicit click
handlers elsewhere.
🤖 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 `@src/lib/components/workspace/CommitTab.svelte`:
- Line 19: The store initialization and dynamic key usage for fileDiffs uses a
plain object which allows prototype-pollution via keys like "__proto__"; change
the initial value for fileDiffs from {} to a null-prototype dictionary (e.g.,
use Object.create(null) when calling $state or initializing the store) and
ensure any subsequent assignments that use file.path as a dynamic key
(references around fileDiffs, and where file.path is used at lines ~64 and
~73-75) also write into a null-prototype object (or recreate a null-prototype
copy before setting keys) so special keys cannot mutate the global prototype.
- Line 34: resetQueue must not set _inFlight = 0 because stale in-flight
requests will later call their .finally() and incorrectly decrement the counter;
instead remove the _inFlight reset and make the fetch/finally handlers
generation-aware: capture the current _gen when scheduling a request and in the
.finally() only decrement _inFlight if the captured gen equals the current _gen
(or otherwise maintain a per-generation inFlight map). Update the resetQueue
function (which currently sets _gen++, _queue = [], _requested = new Set()) to
omit resetting _inFlight, and change the promise-finally logic that currently
decrements _inFlight to check the captured generation before decrementing so
MAX_CONCURRENT enforcement remains correct.

---

Nitpick comments:
In `@src/lib/components/workspace/CommitTab.svelte`:
- Around line 235-240: The reactive effect that syncs the sidebar uses smooth
scrolling which causes animation churn when it runs frequently; in the $effect
that reads activeFileIdx and queries sidebarEl (button via `[data-fi="${fi}"]`)
replace scrollIntoView({ block: 'nearest', behavior: 'smooth' }) with a
non-animated call (e.g., scrollIntoView({ block: 'nearest', behavior: 'auto' }))
so automatic syncing uses instant scrolling while preserving smooth behavior for
explicit click handlers elsewhere.
🪄 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: CHILL

Plan: Pro Plus

Run ID: 1bc97eda-9f40-4279-9bf0-3545d20ccdf5

📥 Commits

Reviewing files that changed from the base of the PR and between e6b1e36 and c4f0a69.

📒 Files selected for processing (1)
  • src/lib/components/workspace/CommitTab.svelte

Comment thread src/lib/components/workspace/CommitTab.svelte Outdated
Comment thread src/lib/components/workspace/CommitTab.svelte Outdated
@anirudhisonline anirudhisonline merged commit ece9c7d into main May 16, 2026
1 check passed
@anirudhisonline anirudhisonline deleted the git-butter branch May 16, 2026 02:53
This was referenced May 16, 2026
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.

1 participant