add auto restore mode (embed)

This commit is contained in:
Vitali sharp8n 2026-09-04 21:05:05 +03:00
parent b9b04fb28d
commit aa3a30b6ad

View file

@ -57,6 +57,16 @@ onMounted(async () => {
if (route.path !== '/') return
try {
snapshots.value = await listRecoverySnapshots()
// When embedded (e.g. the w4c Design Studio passes `?recover=auto`),
// restore every snapshot silently instead of showing the dialog, so
// unsaved work comes back on every open without an extra prompt.
const autoRestore = route.query.recover === 'auto'
if (autoRestore && snapshots.value.length > 0) {
for (const snapshot of [...snapshots.value]) {
await restore(snapshot)
}
return
}
open.value = snapshots.value.length > 0
} catch (error) {
console.warn('[Recovery] Failed to list snapshots:', error)