[eric] cloud: a refusal keeps the way out of it, and Try again actually clears it

This commit is contained in:
ciregenz
2026-08-01 03:39:04 -07:00
parent 13546b8ffb
commit 004c4c37fc
2 changed files with 22 additions and 2 deletions
@@ -97,7 +97,21 @@ const CloudRunSection: React.FC<{ workflow: Workflow; cloud: CloudStatusHandle }
{cloud.pending && <Note wc={WC} tone="quiet">Talking to the cloud</Note>}
{!cloud.pending && cloud.refusal && <Note wc={WC} tone="warn">{cloud.refusal}</Note>}
{/* A refusal used to swallow every other branch, including the one holding the upgrade link, so being told you need Pro removed the way to get Pro. Carry the action through. */}
{!cloud.pending && cloud.refusal && (
<Note wc={WC} tone="warn">
<span>
{cloud.refusal}
{availability.kind === 'blocked' && availability.action === 'sign_in' && (
<button onClick={() => dispatch(openSettingsCard())} style={link}>Sign in</button>
)}
{availability.kind === 'blocked' && availability.action === 'plans' && (
<button onClick={() => dispatch(openSettingsCard())} style={link}>See plans</button>
)}
<button onClick={cloud.retry} style={link}>Try again</button>
</span>
</Note>
)}
{!cloud.pending && !cloud.refusal && availability.kind === 'checking' && (
<Note wc={WC} tone="quiet">Checking what your account allows</Note>
@@ -12,6 +12,7 @@ export interface CloudStatusHandle {
pending: boolean;
/** Set only by a refused flip, and cleared by the next attempt. */
refusal: string | null;
retry: () => void;
choose: (target: CloudTarget, enabled: boolean) => void;
refresh: () => void;
}
@@ -59,5 +60,10 @@ export function useCloudStatus(workflow: Workflow): CloudStatusHandle {
});
}, [dispatch, pending, refresh, workflowId, dashboardId]);
return { probe, pending, refusal, choose, refresh };
// refresh() deliberately leaves `refusal` alone: choose() calls it right after setting one, and
// clearing there would wipe the message before it rendered. A user-driven retry is a different
// intent, so it gets its own door; without it a refusal outlived the thing that caused it.
const retry = useCallback(() => { setRefusal(null); refresh(); }, [refresh]);
return { probe, pending, refusal, choose, refresh, retry };
}