feat(FN-5447): safely narrow checkout nullability in MergeAdvanceNotice

Fixed a TypeScript nullability narrow in the `MergeAdvanceNotice` component, safely handling a potential null checkout value. This is a targeted type-safety fix for the integration branch advance banner.

Fusion-Task-Id: FN-5447
This commit is contained in:
Fusion (runfusion.ai)
2026-05-21 16:41:00 -07:00
committed by gsxdsm
parent bc959c6ca4
commit 14bf3e0540

View File

@@ -113,7 +113,12 @@ export default function MergeAdvanceNotice({ projectId, apiBase = "/api" }: Merg
return null; return null;
} }
const localChangesPreserved = notice.userCheckout.dirty || notice.userCheckout.untrackedCount > 0; if (!notice.userCheckout) {
return null;
}
const checkout = notice.userCheckout;
const localChangesPreserved = checkout.dirty || checkout.untrackedCount > 0;
const dismiss = () => { const dismiss = () => {
const next = [...dismissedShas.filter((sha) => sha !== notice.toSha), notice.toSha].slice(-50); const next = [...dismissedShas.filter((sha) => sha !== notice.toSha), notice.toSha].slice(-50);
@@ -148,7 +153,7 @@ export default function MergeAdvanceNotice({ projectId, apiBase = "/api" }: Merg
<div className="merge-advance-notice" role="status" aria-live="polite"> <div className="merge-advance-notice" role="status" aria-live="polite">
<div className="merge-advance-notice__content"> <div className="merge-advance-notice__content">
<strong>{notice.integrationBranch} advanced to {shortSha(notice.toSha)}.</strong>{" "} <strong>{notice.integrationBranch} advanced to {shortSha(notice.toSha)}.</strong>{" "}
Your checked-out copy at {notice.userCheckout.worktreePath} is behind. Your checked-out copy at {checkout.worktreePath} is behind.
{localChangesPreserved ? " (local changes preserved)" : ""} {localChangesPreserved ? " (local changes preserved)" : ""}
{pullError ? <span className="merge-advance-notice__error"> {pullError}</span> : null} {pullError ? <span className="merge-advance-notice__error"> {pullError}</span> : null}
{pulling ? <span className="merge-advance-notice__hint"> Pulling</span> : null} {pulling ? <span className="merge-advance-notice__hint"> Pulling</span> : null}