PM-32651 resolved double browser url paste problem (#19523)

This commit is contained in:
bmbitwarden 2026-03-13 14:49:54 -04:00 committed by GitHub
parent 91a60d813b
commit 5ddaa031c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,7 +28,7 @@ type SendViewState = (typeof SendViewState)[keyof typeof SendViewState];
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AccessComponent implements OnInit {
readonly viewState = signal<SendViewState>(SendViewState.Auth);
readonly viewState = signal<SendViewState | null>(SendViewState.Auth);
id: string;
key: string;
@ -45,6 +45,18 @@ export class AccessComponent implements OnInit {
this.route.params.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params) => {
this.id = params.sendId;
this.key = params.key;
// when pasting sequential Send URLs into the browser,
// Angular reuses the SendAuthComponent instance
// Reset state so child components are recreated with fresh data
this.sendAccessResponse = null;
this.sendAccessToken = null;
this.sendAccessRequest = new SendAccessRequest();
// Temporarily set viewState to null to destroy the current child component,
// then set it back to Auth on the next tick to recreate it with the new id/key.
this.viewState.set(null);
setTimeout(() => this.viewState.set(SendViewState.Auth));
});
}