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 9, 2024
1 parent 124290f commit 2eee5f9
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 @@ -285,6 +285,7 @@ async function listAsync(): Promise<pxt.workspace.Header[]> {
async function getAsync(h: Header): Promise<pxt.workspace.File> {
const db = await getCurrentDbAsync();
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 @@ -574,7 +574,6 @@ export async function saveAsync(h: Header, text?: ScriptText, fromCloudSync?: bo
text,
version: null
}
allScripts.push(e)
}

const hasUserFileChanges = () => {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2eee5f9

Please sign in to comment.