PM-38423 - FIx unsavedSendEditsGuard not handling null component emission on logout while component is active. (#20967)

This commit is contained in:
Jared Snider 2026-06-01 20:03:11 -04:00 committed by GitHub
parent 157134f500
commit 82246bea68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -3,5 +3,10 @@ import { CanDeactivateFn } from "@angular/router";
import { SendComponent } from "../send.component";
export const unsavedSendEditsGuard: CanDeactivateFn<SendComponent> = async (component) => {
// Angular passes null when the component has already been destroyed mid-navigation
// (e.g. during logout teardown). No edits to save in that case — allow the navigation.
if (component == null) {
return true;
}
return component.saveUnsavedSendEdits();
};

View File

@ -3,5 +3,10 @@ import { CanDeactivateFn } from "@angular/router";
import { SendComponent } from "../send/send.component";
export const unsavedSendEditsGuard: CanDeactivateFn<SendComponent> = async (component) => {
// Angular passes null when the component has already been destroyed mid-navigation
// (e.g. during logout teardown). No edits to save in that case — allow the navigation.
if (component == null) {
return true;
}
return component.saveUnsavedSendEdits();
};