Skip to content

Commit e06bf79

Browse files
committed
move hack to replaceFiddle call instead of set
1 parent 10ec200 commit e06bf79

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/renderer/app.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ export class App {
6969

7070
await this.state.editorMosaic.set(editorValues);
7171

72+
// HACK: editors should be mounted shortly after we load something.
73+
// We could try waiting for every single `editorDidMount` callback
74+
// to fire, but that gets complicated with recycled editors with changed
75+
// values. This is just easier for now.
76+
await new Promise<void>((resolve) =>
77+
setTimeout(async () => {
78+
await this.state.editorMosaic.markAsSaved();
79+
resolve();
80+
}, 100),
81+
);
82+
7283
this.state.gistId = gistId || '';
7384
this.state.localPath = localFiddle?.filePath;
7485
this.state.templateName = templateName;

src/renderer/editor-mosaic.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,6 @@ export class EditorMosaic {
133133
for (const id of this.editors.keys()) {
134134
if (!values.has(id)) this.editors.delete(id);
135135
}
136-
137-
// HACK: editors should be mounted shortly after we load something.
138-
// We could try waiting for every single `editorDidMount` callback
139-
// to fire, but that gets complicated with recycled editors with changed
140-
// values. This is just easier for now.
141-
await new Promise<void>((resolve) =>
142-
setTimeout(async () => {
143-
await this.markAsSaved();
144-
resolve();
145-
}, 100),
146-
);
147136
}
148137

149138
/** Add a file. If we already have a file with that name, replace it. */

0 commit comments

Comments
 (0)