Skip to content

fix(spltis): resizer breaking split ordering integrity on history navigation#2104

Merged
synoet merged 1 commit intomainfrom
synoet/fix-resizer-breaking-split-order
Mar 22, 2026
Merged

fix(spltis): resizer breaking split ordering integrity on history navigation#2104
synoet merged 1 commit intomainfrom
synoet/fix-resizer-breaking-split-order

Conversation

@synoet
Copy link
Copy Markdown
Contributor

@synoet synoet commented Mar 22, 2026

Fix split panels rendering in wrong order on browser back navigation

When two splits are open (e.g. /component/channels + /channel/), closing the left split and then using browser back navigation restores the correct URL but renders the panels on the wrong sides.

Root cause: Resize.Panel passes its index prop to solver.addPanel(panel, index), which uses a falsy guard to check the index:

let index = ndx && ndx < order().length ? ndx : order().length;

When index === 0, 0 is falsy in JS, so the panel is appended at the end instead of inserted at position 0.

Fix: Replace the truthiness check with a null check: ndx != null && ndx < order().length.

@synoet synoet requested a review from a team as a code owner March 22, 2026 02:59
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 22, 2026

Walkthrough

A new test file was introduced for the createResizeSolver function with comprehensive test coverage for the addPanel method. Concurrently, a bug fix was applied to the solver logic that corrects the insertion index validation. The previous condition treated 0 as falsy and skipped it, causing panels to be appended instead of inserted at index zero. The updated condition explicitly checks for null or undefined values, allowing zero to be recognized as a valid insertion position. Tests verify insertion at different indices, appending behavior, and duplicate prevention.

Poem

🐰 A panel at zero—once lost to the void,
Now finds its true place, bugs well destroyed!
Tests dance and verify, index by index,
Insertion flows smoothly—no more need to fix!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main bug fix: resizer breaking split ordering on history navigation, matching the core change in solver.ts.
Description check ✅ Passed The pull request description clearly explains the bug (panels rendering in wrong order on browser back navigation), identifies the root cause (falsy check treating 0 as invalid), and describes the fix (null check instead).

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch synoet/fix-resizer-breaking-split-order

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

@github-actions
Copy link
Copy Markdown

@synoet synoet merged commit 3e76b2b into main Mar 22, 2026
24 checks passed
@synoet synoet deleted the synoet/fix-resizer-breaking-split-order branch March 22, 2026 03:08
Copy link
Copy Markdown

@Nikolay-Pomytkin Nikolay-Pomytkin left a comment

Choose a reason for hiding this comment

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

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants