fix code not saving

This commit is contained in:
Olivier Gagnon 2021-11-02 16:10:01 -04:00
parent a6642a1962
commit d7c23b975c
2 changed files with 6 additions and 5 deletions

@ -259,12 +259,14 @@ export function Root(props: IProps): React.ReactElement {
function updateCode(newCode?: string): void { function updateCode(newCode?: string): void {
if (newCode === undefined) return; if (newCode === undefined) return;
lastCode = newCode; lastCode = newCode;
if (editorRef.current !== null) {
lastPosition = editorRef.current.getPosition();
infLoop(newCode);
}
setCode(newCode); setCode(newCode);
updateRAM(newCode); updateRAM(newCode);
try {
if (editorRef.current !== null) {
lastPosition = editorRef.current.getPosition();
infLoop(newCode);
}
} catch (err) {}
} }
// calculate it once the first time the file is loaded. // calculate it once the first time the file is loaded.

@ -289,6 +289,5 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
Object.assign(Settings.theme, save.theme); Object.assign(Settings.theme, save.theme);
delete save.theme; delete save.theme;
Object.assign(Settings, save); Object.assign(Settings, save);
console.log(Settings);
}, },
}; };