chadtmiller.com/knotless
git that lives in your Atmosphere account
1
10
web: The run workflow dialog lists the ref typed, not one asked before
web/src/lib/organisms/RunWorkflow.svelte+8−1
| @@ -21,13 +21,20 @@ | ||
let busy = $state(false); | ||
const asked = $derived(listed?.workflows.filter((w) => w.asked) ?? []); | ||
| ||
/** How many times the workflows were asked for: an answer to any but the last is let go. */ | ||
let asking = 0; | ||
/** The workflows at the ref named, or the default branch. */ | ||
async function load() { | ||
const mine = ++asking; | ||
problem = ''; | ||
try { | ||
listed = await ask<typeof listWorkflows.main>('dev.knotless.listWorkflows', { repo: repo.uri, ref: ref.trim() || undefined }); | ||
const answer = await ask<typeof listWorkflows.main>('dev.knotless.listWorkflows', { repo: repo.uri, ref: ref.trim() || undefined }); | ||
// The default branch's, asked as the dialog opened, can come after a ref typed since. | ||
if (mine !== asking) return; | ||
listed = answer; | ||
if (!asked.some((w) => w.name === workflow)) workflow = asked[0]?.name ?? ''; | ||
} catch (e) { | ||
if (mine !== asking) return; | ||
listed = null; | ||
problem = (e as Error).message; | ||
} | ||