fix: show a loading indicator while the initial data table migration is generated (#10900)

Claude-Session: https://claude.ai/code/session_01R3YQT3BShZ3ivp25yQ6Smd

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Diego Imbert
2026-08-31 16:34:25 +00:00
committed by GitHub
co-authored by Claude Opus 5
parent 0c2eb0ae3d
commit b998267c91
@@ -52,6 +52,8 @@
let loadError = $state<string | undefined>(undefined)
let loading = $state(false)
let busy = $state(false)
// pg_dump can take a while, so the snapshot gets its own flag to spin its button.
let generatingInitial = $state(false)
// Only workspace admins and super admins can opt a data table in or out.
const canManage = $derived(!!$userStore?.is_admin || !!$superadmin)
@@ -280,6 +282,7 @@
})
if (!confirmed) return
busy = true
generatingInitial = true
try {
await WorkspaceService.generateInitialDatatableMigration({
workspace,
@@ -291,6 +294,7 @@
sendUserToast(`Failed to generate initial migration: ${e?.body ?? e?.message ?? e}`, true)
} finally {
busy = false
generatingInitial = false
}
}
@@ -493,12 +497,13 @@
<div class="flex flex-col grow min-h-0 overflow-auto border rounded-md divide-y">
{#if migrations.length === 0}
<div class="flex flex-col items-center gap-3 p-6 text-sm text-tertiary">
<span>No migrations yet</span>
<span>{generatingInitial ? 'Snapshotting current schema…' : 'No migrations yet'}</span>
<Button
variant="subtle"
size="xs"
startIcon={{ icon: Camera }}
disabled={busy}
loading={generatingInitial}
on:click={generateInitial}
>
Generate initial migration