1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

[PM-9111] Extension: persist add/edit form (#12236)

* remove todo

* Retrieve cache cipher for add-edit form

* user prefilled cipher for add-edit form

* add listener for clearing view cache

* clear local cache when clearing global state

* track initial value of cache for down stream logic that should only occur on non-cached values

* add feature flag for edit form persistence

* add tests for cipher form cache service

* fix optional initialValues

* add services to cipher form storybook

* fix strict types

* rename variables to be platform agnostic

* use deconstructed collectionIds variable to avoid them be overwritten

* use the originalCipherView for initial values

* add comment about signal equality

* prevent events from being emitted when adding uris to the existing form

- This stops other values from being overwrote in the initialization process

* add check for cached cipher when adding initial uris
This commit is contained in:
Nick Krantz
2025-01-22 10:49:07 -06:00
committed by GitHub
parent 1dfae06856
commit 5c32e5020d
22 changed files with 460 additions and 139 deletions

View File

@@ -139,11 +139,13 @@ export class LoginDetailsSectionComponent implements OnInit {
});
}
async ngOnInit() {
if (this.cipherFormContainer.originalCipherView?.login) {
this.initFromExistingCipher(this.cipherFormContainer.originalCipherView.login);
ngOnInit() {
const prefillCipher = this.cipherFormContainer.getInitialCipherView();
if (prefillCipher) {
this.initFromExistingCipher(prefillCipher.login);
} else {
await this.initNewCipher();
this.initNewCipher();
}
if (this.cipherFormContainer.config.mode === "partial-edit") {
@@ -166,7 +168,7 @@ export class LoginDetailsSectionComponent implements OnInit {
}
}
private async initNewCipher() {
private initNewCipher() {
this.loginDetailsForm.patchValue({
username: this.initialValues?.username || "",
password: this.initialValues?.password || "",