diff --git a/html_source/src/app/app.component.ts b/html_source/src/app/app.component.ts index 657e75cd..36df645d 100644 --- a/html_source/src/app/app.component.ts +++ b/html_source/src/app/app.component.ts @@ -113,7 +113,6 @@ export class AppComponent implements OnInit, OnDestroy { this.backendService.initService().subscribe({ next: initMessage => { console.log('Init message: ', initMessage); - this.backendService.getOptions(); this.backendService.webkitLaunchedScript(); this.backendService.start_backend(false, '127.0.0.1', 11512, (st2, dd2) => { @@ -722,6 +721,7 @@ export class AppComponent implements OnInit, OnDestroy { this.getVersion(); setTimeout(() => { + this.backendService.getOptions(); this.getInfo(); }, 10 * 1000); }, diff --git a/html_source/src/app/pages/settings/settings.component.ts b/html_source/src/app/pages/settings/settings.component.ts index 892a3e69..7620ea08 100644 --- a/html_source/src/app/pages/settings/settings.component.ts +++ b/html_source/src/app/pages/settings/settings.component.ts @@ -422,6 +422,8 @@ export class SettingsComponent implements OnInit { this.scale = this.variablesService.settings.scale; this.appUseTor = this.variablesService.settings.appUseTor; this.zanoCompanionForm.setValue(this.variablesService.settings.zanoCompanionForm, { emitEvent: false }); + + this.backend.getOptions(); } ngOnInit(): void { diff --git a/html_source/src/app/parts/directives/disable-price-fetch/disable-price-fetch.directive.ts b/html_source/src/app/parts/directives/disable-price-fetch/disable-price-fetch.directive.ts index 0cabccfc..ef7f1de5 100644 --- a/html_source/src/app/parts/directives/disable-price-fetch/disable-price-fetch.directive.ts +++ b/html_source/src/app/parts/directives/disable-price-fetch/disable-price-fetch.directive.ts @@ -1,7 +1,7 @@ import { Directive, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core'; import { VariablesService } from '../../services/variables.service'; import { Subject } from 'rxjs'; -import { takeUntil } from 'rxjs/operators'; +import { distinctUntilChanged, takeUntil } from 'rxjs/operators'; @Directive({ selector: '[appDisablePriceFetch]', @@ -14,9 +14,12 @@ export class DisablePriceFetchDirective implements OnDestroy { private _templateRef: TemplateRef, private _viewContainer: ViewContainerRef ) { - this._variablesService.disable_price_fetch$.pipe(takeUntil(this.destroy$)).subscribe({ + this._variablesService.disable_price_fetch$.pipe(distinctUntilChanged(), takeUntil(this.destroy$)).subscribe({ next: (disable_price_fetch: boolean) => { - return !disable_price_fetch ? this._viewContainer.createEmbeddedView(this._templateRef) : this._viewContainer.clear(); + this._viewContainer.clear(); + if (!disable_price_fetch) { + this._viewContainer.createEmbeddedView(this._templateRef); + } }, }); }