fix(deploy-to-hub): New draft returns to the folder-picker step instead of erroring

In the live phase the folder picker is hidden, so startNewDraft's
selectedFolder guard always failed with "Pick a folder..." and the user had
no way to pick one. Now New draft goes back to step 1 (predeploy) with the
project's folder pre-selected (inferred from the item paths) so the user can
re-bundle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
tristantr
2026-06-09 18:59:57 +02:00
co-authored by Claude Opus 4.8
parent c031f2ff53
commit 378041e201
@@ -1220,15 +1220,16 @@
syncing = false
}
}
async function startNewDraft() {
if (!selectedFolder || filteredWorkspaceItems.length === 0) {
sendUserToast(`Pick a folder with at least one item before starting a new draft.`, true)
return
}
draftItems = filteredWorkspaceItems.map((i) => ({ ...i, rec: 'none' }))
function startNewDraft() {
const folders = new Set(
draftItems
.map((i) => i.path.split('/').slice(0, 2).join('/'))
.filter((p) => p.startsWith('f/'))
)
selectedFolder = folders.size === 1 ? [...folders][0] : undefined
draftItems = []
recordings = {}
phase = 'draft'
sendUserToast(`New draft started.`)
phase = 'predeploy'
}
async function openRecord(it: DeployItem) {