ui(deploy): loading-aware default for dirty-state baseline

Previously `dirtyState?.dirty ?? true` caused a stale `Redeploy` label
to flash briefly while the first fetch was in flight. Gate the default
on isLoading so the button starts as `Save (disabled)` until the
endpoint resolves — spurious Redeploy clicks were harmless but the
loading-state UX was wrong.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-23 00:42:48 +02:00
parent 8a7f9cb370
commit 4e19f925c6

View File

@@ -62,7 +62,7 @@ export default function AppDeploymentPage() {
const activeDeployment = deployments.find((d) => d.status === 'STARTING') ?? null;
const { data: agentConfig = null } = useApplicationConfig(app?.slug, selectedEnv);
const { data: dirtyState } = useDirtyState(selectedEnv, app?.slug);
const { data: dirtyState, isLoading: dirtyLoading } = useDirtyState(selectedEnv, app?.slug);
// Mutations
const createApp = useCreateApp();
@@ -113,7 +113,11 @@ export default function AppDeploymentPage() {
const dirty = useFormDirty(form, serverState, stagedJar);
const { dialogOpen: blockerOpen, confirm: blockerConfirm, cancel: blockerCancel } =
useUnsavedChangesBlocker(dirty.anyLocalEdit);
const serverDirtyAgainstDeploy = dirtyState?.dirty ?? true;
// Before the first dirty-state fetch resolves, default to "not dirty" so the
// primary button shows `Save (disabled)` — not a stale `Redeploy`. Once loaded,
// fall back to `true` if the endpoint failed entirely (fail-safe for the
// redeploy path).
const serverDirtyAgainstDeploy = app && dirtyLoading ? false : (dirtyState?.dirty ?? true);
const deploymentInProgress = !!activeDeployment;
const primaryMode = computeMode({
deploymentInProgress,