fix: eof when save before load

This commit is contained in:
TaurusXin 2025-02-01 18:57:34 +08:00
parent e4f2d1aaab
commit 4333d0ea2a
Signed by: taurusxin
GPG Key ID: C334DCA04AC2D2CC

View File

@ -74,6 +74,8 @@ const useStyles = makeStyles({
},
})
let loaded = false
export const App = () => {
const styles = useStyles()
@ -199,17 +201,19 @@ export const App = () => {
})
})
Load().then(res => {
console.log(res)
setSaveTo(res.save_to as SaveTo)
setSavePath(res.path)
loaded = true
})
}, [])
useEffect(() => {
Save({
save_to: saveTo,
path: savePath,
}).then(_ => {})
if (loaded) {
Save({
save_to: saveTo,
path: savePath,
}).then(_ => {})
}
}, [saveTo, savePath])
OnFileDrop((_x, _y, paths) => {