Splitter: save initial size for collapsed panels on initialization#33059
Splitter: save initial size for collapsed panels on initialization#33059EugeniyKiyashko wants to merge 1 commit intoDevExpress:26_1from
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the internal Splitter sizing logic so panes that start collapsed (or hidden) with an explicit size remember that initial size and restore it when expanded/shown, rather than falling back to the default “expand to half” behavior.
Changes:
- Added initialization-time caching of pane sizes/directions for initially collapsed or invisible panes that have a defined
size. - Ensured pane size caches are reset early in
_initMarkupand initialized after computing the initial layout. - Added QUnit coverage for expand/show behavior when
collapsed/visibleis set on initialization.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/devextreme/testing/tests/DevExpress.ui.widgets/splitter.tests.js | Adds new pane sizing tests verifying restoration to user-specified sizes for initially collapsed/hidden panes. |
| packages/devextreme/js/__internal/ui/splitter/splitter.ts | Introduces _initPanesCacheSize() and wires it into initial layout computation to preserve initial sizes for collapsed/hidden panes. |
| // @ts-expect-error ts-error | ||
| private _panesCacheSize: (PaneCache | undefined)[]; | ||
|
|
||
| private _panesCacheSizeVisible: (PaneCache | undefined)[] = []; | ||
| // @ts-expect-error ts-error | ||
| private _panesCacheSizeVisible: (PaneCache | undefined)[]; |
There was a problem hiding this comment.
Avoid using // @ts-expect-error to bypass strict property initialization for _panesCacheSize/_panesCacheSizeVisible. This suppresses a type-safety check and will also fail the build if the compiler error disappears later. Prefer initializing the fields (= []) or marking them with definite assignment (!) and keep the runtime reset in _initMarkup as needed.
| this.assertLayout(['50', '30.4878', '19.5122']); | ||
| }); | ||
|
|
||
| QUnit.test('Initially collapsed first pane with small size should expand to user-specified size in 3-pane layout (T0000)', function(assert) { |
There was a problem hiding this comment.
Test name includes a placeholder ticket reference (T0000). Please replace it with the real TFS/GitHub issue ID or remove the placeholder to keep the test suite searchable and maintainable.
| QUnit.test('Initially collapsed first pane with small size should expand to user-specified size in 3-pane layout (T0000)', function(assert) { | |
| QUnit.test('Initially collapsed first pane with small size should expand to user-specified size in 3-pane layout', function(assert) { |
No description provided.