fix: DH-22991: Command history is disappearing - #2720
Merged
mofojed merged 5 commits intoJul 22, 2026
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2720 +/- ##
==========================================
- Coverage 51.40% 51.39% -0.02%
==========================================
Files 796 796
Lines 45720 45738 +18
Branches 11665 11864 +199
==========================================
+ Hits 23504 23507 +3
- Misses 22197 22212 +15
Partials 19 19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mofojed
requested changes
Jul 16, 2026
Comment on lines
+348
to
+358
| // Re-parenting the panel (e.g. removing a sibling panel) resets the scroll | ||
| // container to the top while react-window keeps its internal offset, which | ||
| // leaves the list blank. Re-assert the scroll position purely from the | ||
| // current geometry: clamp the last real offset to the current bounds. On a | ||
| // grow this naturally keeps a bottom-anchored list at the (new) bottom, so | ||
| // restore never needs to reason about sticky state. | ||
| const { itemCount, rowHeight } = this.props; | ||
| const { height } = this.state; | ||
| const maxOffset = Math.max(0, itemCount * rowHeight - (height ?? 0)); | ||
| const newOffset = Math.min(Math.max(scrollOffset, 0), maxOffset); | ||
| container.scrollTo(0, newOffset); |
Member
There was a problem hiding this comment.
We should be checking the isStuckToBottom and if that's true, scroll to maxOffset. Otherwise we can just scroll to the newOffset like we do here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Removing a sibling panel next to Command History caused it to go blank and lose its scroll position. Golden Layout re-parents the Command History DOM node (via
replaceChild), which resets the scroll container to the top while react-window keeps its internal offset — so no items render in the viewport.Fix
ItemListnow re-asserts its scroll position when it's resized (the reliable in-component signal for the reparent):restoreScrollPosition()is now purely geometric — it clamps the last scroll offset to the current bounds (clamp(scrollOffset, 0, itemCount * rowHeight - height)). This restores the correct position and, for a bottom-anchored list moving into a smaller/larger panel, keeps it at the new bottom without any special-casing.handleResize()callsrestoreScrollPosition()after applying the new height.No Golden Layout changes.
Test
Adds an e2e test (
tests/command-history.spec.ts) that scrolls Command History to the middle, removes a sibling panel, and asserts the scroll position and rendered items are preserved.