1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[PM-12303] fix password state spurious emissions (#11670)

* trace generation requests
* eliminate spurious save caused by validator changes
* fix emissions caused by setting bounds attrbutes
---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
✨ Audrey ✨
2024-10-23 14:23:28 -04:00
committed by GitHub
parent 7c79487f04
commit 22be52d2f3
11 changed files with 64 additions and 91 deletions

View File

@@ -1,7 +1,7 @@
import { coerceBooleanProperty } from "@angular/cdk/coercion";
import { OnInit, Input, Output, EventEmitter, Component, OnDestroy } from "@angular/core";
import { FormBuilder } from "@angular/forms";
import { BehaviorSubject, takeUntil, Subject, map, filter, tap, debounceTime, skip } from "rxjs";
import { BehaviorSubject, takeUntil, Subject, map, filter, tap, skip } from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { UserId } from "@bitwarden/common/types/guid";
@@ -132,14 +132,6 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
toValidators(Controls.minSpecial, Generators.password, constraints),
);
// forward word boundaries to the template (can't do it through the rx form)
this.minLength = constraints.length.min;
this.maxLength = constraints.length.max;
this.minMinNumber = constraints.minNumber.min;
this.maxMinNumber = constraints.minNumber.max;
this.minMinSpecial = constraints.minSpecial.min;
this.maxMinSpecial = constraints.minSpecial.max;
this.policyInEffect = constraints.policyInEffect;
const toggles = [
@@ -201,9 +193,6 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
// now that outputs are set up, connect inputs
this.settings.valueChanges
.pipe(
// debounce ensures rapid edits to a field, such as partial edits to a
// spinbox or rapid button clicks don't emit spurious generator updates
debounceTime(this.waitMs),
map((settings) => {
// interface is "avoid" while storage is "include"
const s: any = { ...settings };
@@ -216,24 +205,6 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
.subscribe(settings);
}
/** attribute binding for length[min] */
protected minLength: number;
/** attribute binding for length[max] */
protected maxLength: number;
/** attribute binding for minNumber[min] */
protected minMinNumber: number;
/** attribute binding for minNumber[max] */
protected maxMinNumber: number;
/** attribute binding for minSpecial[min] */
protected minMinSpecial: number;
/** attribute binding for minSpecial[max] */
protected maxMinSpecial: number;
/** display binding for enterprise policy notice */
protected policyInEffect: boolean;