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:
@@ -62,7 +62,7 @@ export default function AppDeploymentPage() {
|
|||||||
const activeDeployment = deployments.find((d) => d.status === 'STARTING') ?? null;
|
const activeDeployment = deployments.find((d) => d.status === 'STARTING') ?? null;
|
||||||
|
|
||||||
const { data: agentConfig = null } = useApplicationConfig(app?.slug, selectedEnv);
|
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
|
// Mutations
|
||||||
const createApp = useCreateApp();
|
const createApp = useCreateApp();
|
||||||
@@ -113,7 +113,11 @@ export default function AppDeploymentPage() {
|
|||||||
const dirty = useFormDirty(form, serverState, stagedJar);
|
const dirty = useFormDirty(form, serverState, stagedJar);
|
||||||
const { dialogOpen: blockerOpen, confirm: blockerConfirm, cancel: blockerCancel } =
|
const { dialogOpen: blockerOpen, confirm: blockerConfirm, cancel: blockerCancel } =
|
||||||
useUnsavedChangesBlocker(dirty.anyLocalEdit);
|
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 deploymentInProgress = !!activeDeployment;
|
||||||
const primaryMode = computeMode({
|
const primaryMode = computeMode({
|
||||||
deploymentInProgress,
|
deploymentInProgress,
|
||||||
|
|||||||
Reference in New Issue
Block a user