@@ -210,43 +210,41 @@ const handleGlobalKeydown = (props, cmController) => (e) => {
210210 }
211211} ;
212212
213- const autosave =
214- ( autosaveInterval , setAutosaveInterval ) => ( props , prevProps ) => {
215- const {
216- autosaveProject,
217- preferences,
218- ide,
219- selectedFile : file ,
220- project,
221- isUserOwner
222- } = props ;
223-
224- const { selectedFile : oldFile } = prevProps ;
225-
226- const doAutosave = ( ) => autosaveProject ( true ) ;
227-
228- if ( isUserOwner && project . id ) {
229- if (
230- preferences . autosave &&
231- ide . unsavedChanges &&
232- ! ide . justOpenedProject
233- ) {
234- if ( file . name === oldFile . name && file . content !== oldFile . content ) {
235- if ( autosaveInterval ) {
236- clearTimeout ( autosaveInterval ) ;
237- }
238- console . log ( 'will save project in 20 seconds' ) ;
239- setAutosaveInterval ( setTimeout ( doAutosave , 20000 ) ) ;
213+ const autosave = ( autosaveInterval , setAutosaveInterval ) => (
214+ props ,
215+ prevProps
216+ ) => {
217+ const {
218+ autosaveProject,
219+ preferences,
220+ ide,
221+ selectedFile : file ,
222+ project,
223+ isUserOwner
224+ } = props ;
225+
226+ const { selectedFile : oldFile } = prevProps ;
227+
228+ const doAutosave = ( ) => autosaveProject ( true ) ;
229+
230+ if ( isUserOwner && project . id ) {
231+ if ( preferences . autosave && ide . unsavedChanges && ! ide . justOpenedProject ) {
232+ if ( file . name === oldFile . name && file . content !== oldFile . content ) {
233+ if ( autosaveInterval ) {
234+ clearTimeout ( autosaveInterval ) ;
240235 }
241- } else if ( autosaveInterval && ! preferences . autosave ) {
242- clearTimeout ( autosaveInterval ) ;
243- setAutosaveInterval ( null ) ;
236+ console . log ( 'will save project in 20 seconds' ) ;
237+ setAutosaveInterval ( setTimeout ( doAutosave , 20000 ) ) ;
244238 }
245- } else if ( autosaveInterval ) {
239+ } else if ( autosaveInterval && ! preferences . autosave ) {
246240 clearTimeout ( autosaveInterval ) ;
247241 setAutosaveInterval ( null ) ;
248242 }
249- } ;
243+ } else if ( autosaveInterval ) {
244+ clearTimeout ( autosaveInterval ) ;
245+ setAutosaveInterval ( null ) ;
246+ }
247+ } ;
250248
251249// ide, preferences, project, selectedFile, user, params, unsavedChanges, expandConsole, collapseConsole,
252250// stopSketch, startSketch, getProject, clearPersistedState, autosaveProject, saveProject, files
0 commit comments