@sumaris-net/ngx-components 2.4.0-rc5 → 2.4.0-rc7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/src/app/core/services/local-settings.service.mjs +5 -5
- package/esm2020/src/app/core/services/network.service.mjs +3 -3
- package/esm2020/src/app/core/table/entities-async-table-datasource.class.mjs +5 -6
- package/fesm2015/sumaris-net.ngx-components.mjs +10 -11
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +10 -11
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -13326,11 +13326,11 @@ class LocalSettingsService extends StartableService {
|
|
|
13326
13326
|
async restoreLocally() {
|
|
13327
13327
|
let data = this._data || {};
|
|
13328
13328
|
// Restore from storage
|
|
13329
|
-
const
|
|
13329
|
+
const settings = await this.storage.get(SETTINGS_STORAGE_KEY);
|
|
13330
13330
|
// Restore local settings (or keep old settings)
|
|
13331
|
-
if (
|
|
13331
|
+
if (isNotNil(settings)) {
|
|
13332
13332
|
console.info('[settings] Restoring previous settings...');
|
|
13333
|
-
const restoredData = JSON.parse(
|
|
13333
|
+
const restoredData = (typeof settings === 'string') ? JSON.parse(settings) : settings;
|
|
13334
13334
|
// Avoid to override transient properties
|
|
13335
13335
|
SETTINGS_TRANSIENT_PROPERTIES.forEach(transientKey => {
|
|
13336
13336
|
delete restoredData[transientKey];
|
|
@@ -13624,7 +13624,7 @@ class LocalSettingsService extends StartableService {
|
|
|
13624
13624
|
}
|
|
13625
13625
|
else {
|
|
13626
13626
|
console.debug('[settings] Store local settings', this._data);
|
|
13627
|
-
return this.storage.set(SETTINGS_STORAGE_KEY,
|
|
13627
|
+
return this.storage.set(SETTINGS_STORAGE_KEY, this._data);
|
|
13628
13628
|
}
|
|
13629
13629
|
}
|
|
13630
13630
|
// Execute with delay
|
|
@@ -15141,8 +15141,8 @@ class NetworkService extends StartableObservableService {
|
|
|
15141
15141
|
*/
|
|
15142
15142
|
async restoreLocally() {
|
|
15143
15143
|
// Restore from storage
|
|
15144
|
-
|
|
15145
|
-
|
|
15144
|
+
let settings = await this.storage.get(SETTINGS_STORAGE_KEY);
|
|
15145
|
+
settings = (typeof settings === 'string') ? JSON.parse(settings) : settings;
|
|
15146
15146
|
if (settings && settings.peerUrl) {
|
|
15147
15147
|
console.debug(`[network] Use peer {${settings.peerUrl}} (found in the local storage)`);
|
|
15148
15148
|
return Peer.parseUrl(settings.peerUrl);
|
|
@@ -29119,13 +29119,12 @@ class EntitiesAsyncTableDataSource extends AsyncTableDataSource {
|
|
|
29119
29119
|
// Sometime, the service miss deletion, or GraphQl cache remove failed.
|
|
29120
29120
|
// In this case, apply missing deletion using the parent delete() function
|
|
29121
29121
|
const rowNotDeleted = this.getRows().filter(row => rows.includes(row));
|
|
29122
|
-
const deleteFn = super.delete;
|
|
29123
29122
|
if (isNotEmptyArray(rowNotDeleted)) {
|
|
29124
29123
|
console.warn(`[entities-table-datasource] Force deletion of ${rowNotDeleted.length} rows! Please check that data service update the cache, after deletion`);
|
|
29125
|
-
|
|
29126
|
-
|
|
29127
|
-
.
|
|
29128
|
-
|
|
29124
|
+
// Start at the end
|
|
29125
|
+
for (const r of rowNotDeleted.sort((a, b) => a.id > b.id ? -1 : 1)) {
|
|
29126
|
+
await super.delete(r.id);
|
|
29127
|
+
}
|
|
29129
29128
|
}
|
|
29130
29129
|
}
|
|
29131
29130
|
catch (err) {
|