Skip to content

Commit 560f417

Browse files
fix issue with explorer not showing unsynced state in live
1 parent da2a2eb commit 560f417

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

packages/app/src/app/overmind/namespaces/live/internalActions.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,22 @@ export const initializeModuleState: Action<any> = (
105105
);
106106

107107
if (index > -1) {
108-
if (moduleInfo.code != null) {
109-
state.editor.currentSandbox.modules[index].code = moduleInfo.code;
108+
if (moduleInfo.code === null) {
109+
return;
110110
}
111-
if (!moduleInfo.synced) {
112-
state.editor.changedModuleShortids.push(moduleShortid);
111+
112+
// If we are getting code that has not been saved, we want to update the actual saved code
113+
// so that we properly detect "changed files" in the explorer. But we only do this if the
114+
// savedCode is not set, as we might get multiple initializeModuleState
115+
if (
116+
!moduleInfo.synced &&
117+
state.editor.currentSandbox.modules[index].savedCode == null
118+
) {
119+
state.editor.currentSandbox.modules[index].savedCode =
120+
state.editor.currentSandbox.modules[index].code;
113121
}
122+
123+
state.editor.currentSandbox.modules[index].code = moduleInfo.code;
114124
}
115125
});
116126

0 commit comments

Comments
 (0)