feat: enhance note saving functionality with immediate cache invalidation (#9725)

This commit is contained in:
SuYao 2025-08-31 18:15:34 +08:00 committed by GitHub
parent 03ebc4a794
commit 10d6256ce1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,11 +84,13 @@ const NotesPage: FC = () => {
try {
await window.api.file.write(activeFilePath, content)
// 保存后立即刷新缓存,确保下次读取时获取最新内容
invalidateFileContent(activeFilePath)
} catch (error) {
logger.error('Failed to save note:', error as Error)
}
},
[activeFilePath, currentContent]
[activeFilePath, currentContent, invalidateFileContent]
)
// 防抖保存函数,在停止输入后才保存,避免输入过程中的文件写入