Revert "Deflake project settings override on desktop (#4370)" (#4450)

* Revert "Deflake project settings override on desktop (#4370)"

This reverts commit ad1cd56891.

* Part of the revert
This commit is contained in:
49fl
2024-11-08 17:16:46 -05:00
committed by GitHub
parent 2bc4f076cb
commit b11040c23c
8 changed files with 34 additions and 49 deletions

View File

@ -121,28 +121,20 @@ export default class CodeManager {
// Only write our buffer contents to file once per second. Any faster
// and file-system watchers which read, will receive empty data during
// writes.
clearTimeout(this.timeoutWriter)
this.writeCausedByAppCheckedInFileTreeFileSystemWatcher = true
return new Promise((resolve, reject) => {
this.timeoutWriter = setTimeout(() => {
if (!this._currentFilePath)
return reject(new Error('currentFilePath not set'))
// Wait one event loop to give a chance for params to be set
// Save the file to disk
this.timeoutWriter = setTimeout(() => {
// Wait one event loop to give a chance for params to be set
// Save the file to disk
this._currentFilePath &&
window.electron
.writeFile(this._currentFilePath, this.code ?? '')
.then(resolve)
.catch((err: Error) => {
// TODO: add tracing per GH issue #254 (https://github.com/KittyCAD/modeling-app/issues/254)
console.error('error saving file', err)
toast.error('Error saving file, please check file permissions')
reject(err)
})
}, 1000)
})
}, 1000)
} else {
safeLSSetItem(PERSIST_CODE_KEY, this.code)
}