Skip to content

Splitter: save initial size for collapsed panels on initialization#33059

Open
EugeniyKiyashko wants to merge 1 commit intoDevExpress:26_1from
EugeniyKiyashko:26_1_splitter_collapsed_cache
Open

Splitter: save initial size for collapsed panels on initialization#33059
EugeniyKiyashko wants to merge 1 commit intoDevExpress:26_1from
EugeniyKiyashko:26_1_splitter_collapsed_cache

Conversation

@EugeniyKiyashko
Copy link
Contributor

No description provided.

@EugeniyKiyashko EugeniyKiyashko self-assigned this Mar 26, 2026
@EugeniyKiyashko EugeniyKiyashko requested a review from a team as a code owner March 26, 2026 15:24
Copilot AI review requested due to automatic review settings March 26, 2026 15:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 _initMarkup and initialized after computing the initial layout.
  • Added QUnit coverage for expand/show behavior when collapsed/visible is 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.

Comment on lines +121 to +125
// @ts-expect-error ts-error
private _panesCacheSize: (PaneCache | undefined)[];

private _panesCacheSizeVisible: (PaneCache | undefined)[] = [];
// @ts-expect-error ts-error
private _panesCacheSizeVisible: (PaneCache | undefined)[];
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
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) {
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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) {

Copilot uses AI. Check for mistakes.
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