File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
packages/app/src/app/overmind/namespaces/live Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments