Skip to content

Conversation

@remyhersbach
Copy link

@remyhersbach remyhersbach commented Jan 30, 2026

Because counts are used as id's, wrong splitters will be moved if splitters are being destroyed.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed splitter instance tracking during destruction, ensuring proper cleanup of global event listeners and resource management.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

A decrement operation was removed from the splitter's destroy path, preventing the global active splitter counter from being decreased during destruction. This alters the bookkeeping logic for tracking active splitters and impacts the reset condition for global event listeners.

Changes

Cohort / File(s) Summary
Splitter Destroy Logic
js/jquery.splitter.js
Removed count-- decrement in destroy method, affecting global splitter counter bookkeeping and event listener reset conditions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A counter once fell, but now stands still,
The splitter's last breath—no decrement thrill,
One line removed with curious might,
Bookkeeping whispers through code's quiet night,
Watch closely, dear dev, for this change feels tight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: fixing incorrect splitter IDs by not decrementing the counter during destruction, which was causing wrong splitters to be moved.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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.

❤️ Share

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

@jcubic
Copy link
Owner

jcubic commented Jan 30, 2026

Can you create a small reproduction of the problem and how the PR resolves the issue?

@remyhersbach
Copy link
Author

remyhersbach commented Feb 2, 2026

Can you create a small reproduction of the problem and how the PR resolves the issue?

This is a view of our application in which we use multiple jquery.splitters. As you can see in the end the wrong splitter is used.

Screen.Recording.2026-02-02.at.10.43.18.mov

The problem is that when a splitter is destroyed, splitters[id] is set to null, but count is decremented. New splitters can then get the same index.

Create Splitter A: id = 0, count = 1, splitters[0] = A
Create Splitter B: id = 1, count = 2, splitters[1] = B
Destroy Splitter A: splitters[0] = null, count = 1
Create Splitter C: id = 1, count = 2, splitters[1] = C (OVERWRITES B!)
Splitter B's id is still 1, but splitters[1] now points to C.
The fix is ​​to NOT decrease the count, so that IDs remain unique.

@jcubic
Copy link
Owner

jcubic commented Feb 2, 2026

Can you create a small reproduction that I can run? I can't run your video.

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.

2 participants