Skip to content

Commit 7e03969

Browse files
committed
autosave
1 parent 29db062 commit 7e03969

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

client/modules/IDE/pages/IDEView.jsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ const IDEView = (props) => {
8888
const autosaveIntervalRef = useRef(null);
8989

9090
const prevFileNameRef = useRef(selectedFile.name);
91-
const prevFileContentRef = useRef(selectedFile.content);
9291
const locationRef = useRef(props.location);
9392

9493
const syncFileContent = () => {
@@ -122,10 +121,10 @@ const IDEView = (props) => {
122121
preferences.autosave &&
123122
ide.unsavedChanges &&
124123
!ide.justOpenedProject &&
125-
selectedFile.name === prevFileNameRef.current &&
126-
selectedFile.content !== prevFileContentRef.current
124+
selectedFile.name === prevFileNameRef.current
127125
) {
128126
dispatch(autosaveProject());
127+
console.log('saveee');
129128
}
130129
};
131130

@@ -134,10 +133,9 @@ const IDEView = (props) => {
134133
}
135134

136135
if (preferences.autosave) {
137-
autosaveIntervalRef.current = setTimeout(handleAutosave, 20000);
136+
autosaveIntervalRef.current = setTimeout(handleAutosave, 10000);
138137
}
139138
prevFileNameRef.current = selectedFile.name;
140-
prevFileContentRef.current = selectedFile.content;
141139

142140
return () => {
143141
if (autosaveIntervalRef.current) {
@@ -151,7 +149,6 @@ const IDEView = (props) => {
151149
ide.unsavedChanges,
152150
ide.justOpenedProject,
153151
selectedFile.name,
154-
selectedFile.content,
155152
dispatch,
156153
autosaveProject
157154
]);

0 commit comments

Comments
 (0)