From 757e1480329d11521c1ef7afb78702a251fd5b89 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Tue, 8 Jun 2021 18:18:56 +0200 Subject: [PATCH 1/4] fix: possible workaround? --- .../src/lib/storage-manager/storage-manager.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/src/lib/storage-manager/storage-manager.js b/frontend/src/lib/storage-manager/storage-manager.js index 418d92224..c44c8710f 100644 --- a/frontend/src/lib/storage-manager/storage-manager.js +++ b/frontend/src/lib/storage-manager/storage-manager.js @@ -327,6 +327,7 @@ export class StorageManager { const url = (options.history && options.history.url) || (this._global.document && this._global.document.location); const state = this._global.history.state || {}; + //alert('Current State of history: ' + JSON.stringify(state)); state[this.namespace] = this._updateStorage({}, value, LOCATION.HISTORY, options); this._debugLog('_saveToHistory', { state: state, push: push, title: title, url: url}); @@ -359,6 +360,12 @@ export class StorageManager { addHistoryListener(listener, options=this._options, ...args) { const modified_listener = (function(event, ...listener_args) { // eslint-disable-line no-unused-vars + alert('Event:' + JSON.stringify(event)); + + //possible solution: popstate event does not have a state + if(event.state === null) + return; + this._global.setTimeout(() => listener(this._getFromHistory(options), ...listener_args)); }).bind(this); @@ -472,10 +479,10 @@ export class StorageManager { }).catch(console.error); } - _debugLog() {} - // _debugLog(fName, ...args) { - // console.log(`[DEBUGLOG] StorageManager.${fName}`, { args: args, instance: this }); - // } + //_debugLog() {} + _debugLog(fName, ...args) { + console.log(`[DEBUGLOG] StorageManager.${fName}`, { args: args, instance: this }); + } } From f807e2af78aa0d1d135990d764df9da89a0e61d0 Mon Sep 17 00:00:00 2001 From: Johannes Eder Date: Thu, 10 Jun 2021 17:48:22 +0200 Subject: [PATCH 2/4] fix: added check in async table and removeddebug log output --- frontend/src/lib/storage-manager/storage-manager.js | 9 ++++----- frontend/src/utils/async-table/async-table.js | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/src/lib/storage-manager/storage-manager.js b/frontend/src/lib/storage-manager/storage-manager.js index c44c8710f..7c91d6a77 100644 --- a/frontend/src/lib/storage-manager/storage-manager.js +++ b/frontend/src/lib/storage-manager/storage-manager.js @@ -360,7 +360,6 @@ export class StorageManager { addHistoryListener(listener, options=this._options, ...args) { const modified_listener = (function(event, ...listener_args) { // eslint-disable-line no-unused-vars - alert('Event:' + JSON.stringify(event)); //possible solution: popstate event does not have a state if(event.state === null) @@ -479,10 +478,10 @@ export class StorageManager { }).catch(console.error); } - //_debugLog() {} - _debugLog(fName, ...args) { - console.log(`[DEBUGLOG] StorageManager.${fName}`, { args: args, instance: this }); - } + _debugLog() {} + //_debugLog(fName, ...args) { + // console.log(`[DEBUGLOG] StorageManager.${fName}`, { args: args, instance: this }); + //} } diff --git a/frontend/src/utils/async-table/async-table.js b/frontend/src/utils/async-table/async-table.js index 3dbaad95e..93d3bcf99 100644 --- a/frontend/src/utils/async-table/async-table.js +++ b/frontend/src/utils/async-table/async-table.js @@ -125,7 +125,7 @@ export class AsyncTable { const historyUrl = historyState ? historyState['currentTableUrl'] : this._historyStorage.load('currentTableUrl'); this._debugLog('_historyListener', historyState, windowUrl, historyUrl); - if (this._isEquivalentUrl(windowUrl, historyUrl)) + if (this._isEquivalentUrl(windowUrl, historyUrl || document.location.href)) return; this._debugLog('_historyListener', historyUrl); From d6bbbec629e9037e3245e28d47242be8ae33c2ad Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 10 Jun 2021 16:06:16 +0000 Subject: [PATCH 3/4] chore: removed comment --- frontend/src/lib/storage-manager/storage-manager.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/lib/storage-manager/storage-manager.js b/frontend/src/lib/storage-manager/storage-manager.js index 7c91d6a77..85344ccdb 100644 --- a/frontend/src/lib/storage-manager/storage-manager.js +++ b/frontend/src/lib/storage-manager/storage-manager.js @@ -327,7 +327,6 @@ export class StorageManager { const url = (options.history && options.history.url) || (this._global.document && this._global.document.location); const state = this._global.history.state || {}; - //alert('Current State of history: ' + JSON.stringify(state)); state[this.namespace] = this._updateStorage({}, value, LOCATION.HISTORY, options); this._debugLog('_saveToHistory', { state: state, push: push, title: title, url: url}); From 8bb554cd6055563c9211ba24f4bffc65459259ca Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 10 Jun 2021 16:07:24 +0000 Subject: [PATCH 4/4] chore: changed comment. --- frontend/src/lib/storage-manager/storage-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/lib/storage-manager/storage-manager.js b/frontend/src/lib/storage-manager/storage-manager.js index 85344ccdb..f2ee68589 100644 --- a/frontend/src/lib/storage-manager/storage-manager.js +++ b/frontend/src/lib/storage-manager/storage-manager.js @@ -360,7 +360,7 @@ export class StorageManager { addHistoryListener(listener, options=this._options, ...args) { const modified_listener = (function(event, ...listener_args) { // eslint-disable-line no-unused-vars - //possible solution: popstate event does not have a state + // do not propagate popstate events with empty state if(event.state === null) return;