Skip to content

Commit f086ebf

Browse files
committed
actually open to file when new blocks file created
1 parent 885e181 commit f086ebf

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

webapp/src/app.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,12 +1470,19 @@ export class ProjectView
14701470
}
14711471

14721472
updateFileAsync(name: string, content: string, open?: boolean): Promise<void> {
1473-
const p = pkg.mainEditorPkg();
1474-
return p.setContentAsync(name, content)
1473+
const mainPkg = pkg.mainEditorPkg();
1474+
return mainPkg.setContentAsync(name, content)
1475+
.then(() => this.reloadHeaderAsync())
14751476
.then(() => {
1476-
if (open) this.setFile(p.lookupFile("this/" + name));
1477+
if (open) {
1478+
const reloadedPkg = pkg.mainEditorPkg();
1479+
const file = reloadedPkg.lookupFile("this/" + name);
1480+
if (file) {
1481+
if (pxteditor.isBlocks(file)) this.setSideFile(file);
1482+
else this.setFile(file);
1483+
}
1484+
}
14771485
})
1478-
.then(() => this.reloadHeaderAsync())
14791486
}
14801487

14811488
isSideDocExpanded(): boolean {

0 commit comments

Comments
 (0)