diff --git a/src/ts/editor/state.ts b/src/ts/editor/state.ts
index e818b2a8..c3a6b2f5 100644
--- a/src/ts/editor/state.ts
+++ b/src/ts/editor/state.ts
@@ -599,9 +599,6 @@ export class EditorState extends ListenersMixin(Base) {
}
});
- // Unset the existing file since it is 'unloaded'.
- this.file = undefined;
-
// Mark the file path that is being loaded.
this.loadingFilePath = file.path;
diff --git a/src/ts/editor/ui/parts/content.ts b/src/ts/editor/ui/parts/content.ts
index ad83997f..2d2315d3 100644
--- a/src/ts/editor/ui/parts/content.ts
+++ b/src/ts/editor/ui/parts/content.ts
@@ -138,7 +138,7 @@ export class ContentPart extends BasePart implements UiPartComponent {
subParts.push(this.partToolbar.template());
- if (this.config.editor.state.inProgress(StatePromiseKeys.GetFile)) {
+ if (this.config.editor.state.loadingFilePath) {
subParts.push(html`
${templateLoading(
{},
diff --git a/src/ts/editor/ui/parts/content/toolbar.ts b/src/ts/editor/ui/parts/content/toolbar.ts
index fdb87555..9687015f 100644
--- a/src/ts/editor/ui/parts/content/toolbar.ts
+++ b/src/ts/editor/ui/parts/content/toolbar.ts
@@ -103,7 +103,7 @@ export class ContentToolbarPart extends BasePart implements UiPartComponent {
}
templateIconRefresh(): TemplateResult {
- if (!this.config.state.file) {
+ if (!this.config.state.file || this.config.state.loadingFilePath) {
return html``;
}
diff --git a/src/ts/editor/ui/parts/preview.ts b/src/ts/editor/ui/parts/preview.ts
index b832516a..6cae2ce3 100644
--- a/src/ts/editor/ui/parts/preview.ts
+++ b/src/ts/editor/ui/parts/preview.ts
@@ -156,7 +156,10 @@ export class PreviewPart extends BasePart implements UiPartComponent {
templatePreviewNotAvailable(): TemplateResult {
// When waiting for the file to load do not show anything
// since the file load is already showing.
- if (this.config.editor.state.inProgress(StatePromiseKeys.GetFile)) {
+ if (
+ !this.config.state.loadingFilePath &&
+ this.config.editor.state.inProgress(StatePromiseKeys.GetFile)
+ ) {
return html``;
}