diff --git a/webapp/src/idbworkspace.ts b/webapp/src/idbworkspace.ts index fd81fc8c078..623bc1b2770 100644 --- a/webapp/src/idbworkspace.ts +++ b/webapp/src/idbworkspace.ts @@ -285,6 +285,7 @@ async function listAsync(): Promise { async function getAsync(h: Header): Promise { const db = await getCurrentDbAsync(); const res = await db.getAsync(TEXTS_TABLE, h.id); + if (!res) return undefined; return { header: h, text: res.files, diff --git a/webapp/src/workspace.ts b/webapp/src/workspace.ts index c5483500029..839eb07f4fc 100644 --- a/webapp/src/workspace.ts +++ b/webapp/src/workspace.ts @@ -574,7 +574,6 @@ export async function saveAsync(h: Header, text?: ScriptText, fromCloudSync?: bo text, version: null } - allScripts.push(e) } const hasUserFileChanges = () => { @@ -693,6 +692,10 @@ export async function saveAsync(h: Header, text?: ScriptText, fromCloudSync?: bo e.version = ver; } + if (newSave) { + allScripts.push(e); + } + if (isUserChange) { h.pubCurrent = false; h.cloudCurrent = false;