<script>
  let { onclick } = $props()
  let loading = $state(false)

  async function handle() {
    loading = true
    try { await onclick() } finally { loading = false }
  }
</script>

<button class="btn btn-success btn-sm" onclick={handle} disabled={loading}>
  {loading ? '…' : '✓ Ready'}
</button>
