Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,9 @@ class PivotGridDataSource {
values: this.getAreaFields('data'),
filters: applyFilters
? this._fields.filter((f) => f !== field
&& f.area
&& f.filterValues
&& f.filterValues.length)
&& f.area
&& f.filterValues
&& f.filterValues.length)
: [],
skipValues: true,
};
Expand Down Expand Up @@ -839,8 +839,8 @@ class PivotGridDataSource {
}

if (field.levels
&& dimension !== descriptions.filters
&& dimension !== descriptions.values) {
&& dimension !== descriptions.filters
&& dimension !== descriptions.values) {
dimension.push.apply(dimension, field.levels);
if (field.filterValues && field.filterValues.length) {
descriptions.filters.push(field);
Expand Down Expand Up @@ -1049,9 +1049,9 @@ class PivotGridDataSource {
if (store) {
extend(options, descriptions);
options.columnExpandedPaths = options.columnExpandedPaths
|| this.getExpandedPaths(this._data, options, 'columns', that._lastLoadOptions);
|| this.getExpandedPaths(this._data, options, 'columns', that._lastLoadOptions);
options.rowExpandedPaths = options.rowExpandedPaths
|| this.getExpandedPaths(this._data, options, 'rows', that._lastLoadOptions);
|| this.getExpandedPaths(this._data, options, 'rows', that._lastLoadOptions);

if (paginate) {
options.pageSize = this._pageSize;
Expand All @@ -1076,7 +1076,7 @@ class PivotGridDataSource {

storeLoadOptions = storeLoadOptions
.filter((options) => !(options.rows.length && options.rowTake === 0)
&& !(options.columns.length && options.columnTake === 0));
&& !(options.columns.length && options.columnTake === 0));

if (!storeLoadOptions.length) {
that._update(deferred);
Expand Down Expand Up @@ -1130,8 +1130,8 @@ class PivotGridDataSource {

paginate() {
return this._paginate
&& this._store
&& this._store.supportPaging();
&& this._store
&& this._store.supportPaging();
}

isEmpty() {
Expand Down Expand Up @@ -1160,8 +1160,8 @@ class PivotGridDataSource {
that._sort(descriptions, loadedData);

!that.isEmpty()
&& isRunningTotalUsed(dataFields)
&& summaryUtils.applyRunningTotal(descriptions, loadedData);
&& isRunningTotalUsed(dataFields)
&& summaryUtils.applyRunningTotal(descriptions, loadedData);

that._data = loadedData;
deferred !== false && when(deferred).done(() => {
Expand Down Expand Up @@ -1405,6 +1405,9 @@ class PivotGridDataSource {
if (delayedLoadTask) {
delayedLoadTask.abort();
}

that._store?.dispose();

this._isDisposed = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import ArrayStore from '@js/common/data/array_store';
import { CustomStore } from '@js/common/data/custom_store';
import { DataSource } from '@js/common/data/data_source/data_source';
import dataQuery from '@js/common/data/query';
// eslint-disable-next-line import/extensions
import { aggregators } from '@js/common/data/utils';
import Class from '@js/core/class';
import { noop } from '@js/core/utils/common';
Expand Down Expand Up @@ -585,6 +584,10 @@ const LocalStore = Class.inherit((function () {

return drillDownItems;
},

dispose() {
this._dataSource?.dispose();
},
};
})()).include(storeDrillDownMixin);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,10 @@ class RemoteStore {
},
});
}

dispose() {
this._dataSource?.dispose();
}
}

export default { RemoteStore };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,9 @@ class XmlaStore {
return true;
}

dispose() {
}

getDrillDownItems(options, params) {
// @ts-expect-error
const result = new Deferred();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6917,6 +6917,29 @@ QUnit.module('Stores', () => {
});
});

QUnit.test('PivotGridDataSource dispose disposes LocalStore', function(assert) {
const dataSource = new PivotGridDataSource({
store: window.orders
});
const store = dataSource.store();

dataSource.dispose();

assert.ok(store._dataSource._disposed, 'LocalStore internal DataSource is disposed');
});

QUnit.test('PivotGridDataSource dispose disposes RemoteStore', function(assert) {
const dataSource = new PivotGridDataSource({
remoteOperations: true,
store: window.orders
});
const store = dataSource.store();

dataSource.dispose();

assert.ok(store._dataSource._disposed, 'RemoteStore internal DataSource is disposed');
});
Comment on lines +6920 to +6941
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The tests for LocalStore and RemoteStore disposal both access the internal _dataSource property to verify disposal. However, there's no corresponding test for XmlaStore disposal, even though an empty dispose() method was added to it. Consider adding a test for XmlaStore to maintain consistent test coverage across all store types, or add a comment explaining why XmlaStore doesn't need disposal testing (because it doesn't maintain an internal DataSource).

Copilot uses AI. Check for mistakes.


});

Loading