From e6179496deff7eecb265ce2a5ffdfdfb3d5cba5b Mon Sep 17 00:00:00 2001 From: sergey arzamasov Date: Fri, 13 Sep 2024 18:15:51 +0300 Subject: [PATCH] =?UTF-8?q?DataGrid=20-=20Move=20from=20depeceted=20'unloa?= =?UTF-8?q?d'=20event=20to=20'visibilitychange'=20(=E2=80=A6=20(#28049)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sergey Arzamasov --- .../grids/grid_core/state_storing/m_state_storing_core.ts | 4 ++-- .../DevExpress.ui.widgets.dataGrid/stateStoring.tests.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/devextreme/js/__internal/grids/grid_core/state_storing/m_state_storing_core.ts b/packages/devextreme/js/__internal/grids/grid_core/state_storing/m_state_storing_core.ts index f4f57006553d..5db0ddc0b4c1 100644 --- a/packages/devextreme/js/__internal/grids/grid_core/state_storing/m_state_storing_core.ts +++ b/packages/devextreme/js/__internal/grids/grid_core/state_storing/m_state_storing_core.ts @@ -80,7 +80,7 @@ export class StateStoringController extends modules.ViewController { } }; - eventsEngine.on(getWindow(), 'unload', this._windowUnloadHandler); + eventsEngine.on(getWindow(), 'visibilitychange', this._windowUnloadHandler); return this; // needed by pivotGrid mocks } @@ -103,7 +103,7 @@ export class StateStoringController extends modules.ViewController { public dispose() { clearTimeout(this._savingTimeoutID); - eventsEngine.off(getWindow(), 'unload', this._windowUnloadHandler); + eventsEngine.off(getWindow(), 'visibilitychange', this._windowUnloadHandler); } private _loadState() { diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/stateStoring.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/stateStoring.tests.js index 103bff0cdfc3..1ee65154aa5a 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/stateStoring.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/stateStoring.tests.js @@ -77,7 +77,7 @@ QUnit.module('Local storage', { assert.ok(!localStorage.getItem('TestNameSpace'), 'state not saved'); // act - $(window).trigger('unload'); + $(window).trigger('visibilitychange'); // assert assert.equal(parseInt(JSON.parse(localStorage.getItem('TestNameSpace')).testSetting), 107, 'state saved');