mirror of
https://github.com/bitwarden/clients.git
synced 2026-07-07 21:10:55 +08:00
PM-32651 resolved double browser url paste problem (#19523)
This commit is contained in:
parent
91a60d813b
commit
5ddaa031c9
@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user