Skip to content

Commit

Permalink
fix interleaving of save/sync operations
Browse files Browse the repository at this point in the history
  • Loading branch information
riknoll committed Sep 13, 2024
1 parent d5687bf commit 4db142d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions webapp/src/idbworkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ async function listAsync(): Promise<pxt.workspace.Header[]> {
async function getAsync(h: Header): Promise<pxt.workspace.File> {
const db = await getDbAsync();
const res = await db.getAsync<StoredText>(TEXTS_TABLE, h.id);
if (!res) return undefined;
return {
header: h,
text: res.files,
Expand Down
5 changes: 4 additions & 1 deletion webapp/src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ export async function saveAsync(h: Header, text?: ScriptText, fromCloudSync?: bo
text,
version: null
}
allScripts.push(e)
}

const hasUserFileChanges = () => {
Expand Down Expand Up @@ -667,6 +666,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;
Expand Down

0 comments on commit 4db142d

Please sign in to comment.