mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-06 23:51:28 +01:00
[PM-14001] do not store last value when it is 0 (#11964)
This commit is contained in:
parent
ed3ec8ef39
commit
ba82a31851
@ -171,10 +171,10 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
|
|||||||
this.minNumber.valueChanges
|
this.minNumber.valueChanges
|
||||||
.pipe(
|
.pipe(
|
||||||
map((value) => [value, value > 0] as const),
|
map((value) => [value, value > 0] as const),
|
||||||
tap(([value]) => (lastMinNumber = this.numbers.value ? value : lastMinNumber)),
|
tap(([value, checkNumbers]) => (lastMinNumber = checkNumbers ? value : lastMinNumber)),
|
||||||
takeUntil(this.destroyed$),
|
takeUntil(this.destroyed$),
|
||||||
)
|
)
|
||||||
.subscribe(([, checked]) => this.numbers.setValue(checked, { emitEvent: false }));
|
.subscribe(([, checkNumbers]) => this.numbers.setValue(checkNumbers, { emitEvent: false }));
|
||||||
|
|
||||||
let lastMinSpecial = 1;
|
let lastMinSpecial = 1;
|
||||||
this.special.valueChanges
|
this.special.valueChanges
|
||||||
@ -188,10 +188,10 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
|
|||||||
this.minSpecial.valueChanges
|
this.minSpecial.valueChanges
|
||||||
.pipe(
|
.pipe(
|
||||||
map((value) => [value, value > 0] as const),
|
map((value) => [value, value > 0] as const),
|
||||||
tap(([value]) => (lastMinSpecial = this.special.value ? value : lastMinSpecial)),
|
tap(([value, checkSpecial]) => (lastMinSpecial = checkSpecial ? value : lastMinSpecial)),
|
||||||
takeUntil(this.destroyed$),
|
takeUntil(this.destroyed$),
|
||||||
)
|
)
|
||||||
.subscribe(([, checked]) => this.special.setValue(checked, { emitEvent: false }));
|
.subscribe(([, checkSpecial]) => this.special.setValue(checkSpecial, { emitEvent: false }));
|
||||||
|
|
||||||
// `onUpdated` depends on `settings` because the UserStateSubject is asynchronous;
|
// `onUpdated` depends on `settings` because the UserStateSubject is asynchronous;
|
||||||
// subscribing directly to `this.settings.valueChanges` introduces a race condition.
|
// subscribing directly to `this.settings.valueChanges` introduces a race condition.
|
||||||
|
Loading…
Reference in New Issue
Block a user