Fix xxxWindowPreference management
This commit is contained in:
@@ -78,6 +78,7 @@ export class PoolRankingComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
onChangeWindowPreference(e) {
|
||||
this.storageService.setValue('poolsWindowPreference', e.target.value);
|
||||
this.poolsWindowPreference = e.target.value;
|
||||
this.isLoading = true;
|
||||
this.refreshMiningStats();
|
||||
|
||||
@@ -13,12 +13,17 @@ export class StorageService {
|
||||
setDefaultValueIfNeeded(key: string, defaultValue: string) {
|
||||
let graphWindowPreference: string = this.getValue(key);
|
||||
if (graphWindowPreference === null) { // First visit to mempool.space
|
||||
if (this.router.url.includes("graphs") || this.router.url.includes("pools")) {
|
||||
if (this.router.url.includes('graphs') && key === 'graphWindowPreference' ||
|
||||
this.router.url.includes('pools') && key === 'poolsWindowPreference'
|
||||
) {
|
||||
this.setValue(key, this.route.snapshot.fragment ? this.route.snapshot.fragment : defaultValue);
|
||||
} else {
|
||||
this.setValue(key, defaultValue);
|
||||
}
|
||||
} else if (this.router.url.includes("graphs") || this.router.url.includes("pools")) { // Visit a different graphs#fragment from last visit
|
||||
} else if (this.router.url.includes('graphs') && key === 'graphWindowPreference' ||
|
||||
this.router.url.includes('pools') && key === 'poolsWindowPreference'
|
||||
) {
|
||||
// Visit a different graphs#fragment from last visit
|
||||
if (this.route.snapshot.fragment !== null && graphWindowPreference !== this.route.snapshot.fragment) {
|
||||
this.setValue(key, this.route.snapshot.fragment);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user