Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2026-02-10 10:22:34 +08:00
commit 52429a6782
2 changed files with 19 additions and 16 deletions

View file

@ -936,6 +936,7 @@ func RenameAsset(oldPath, newName string) (newPath string, err error) {
return
}
cache.RemoveTreeData(util.GetTreeID(treeAbsPath))
p := filepath.ToSlash(strings.TrimPrefix(treeAbsPath, filepath.Join(util.DataDir, notebook.ID)))
tree, parseErr := filesys.LoadTreeByData(data, notebook.ID, p, luteEngine)
if nil != parseErr {

View file

@ -292,23 +292,23 @@ func removeIndexes(removeFilePaths []string) (removeRootIDs []string) {
continue
}
id := util.GetTreeID(removeFile)
removeRootIDs = append(removeRootIDs, id)
block := treenode.GetBlockTree(id)
if nil != block {
msg := fmt.Sprintf(Conf.Language(39), block.RootID)
util.IncBootProgress(bootProgressPart, msg)
util.PushStatusBar(msg)
rootID := util.GetTreeID(removeFile)
removeRootIDs = append(removeRootIDs, rootID)
bts := treenode.GetBlockTreesByRootID(block.RootID)
for _, b := range bts {
cache.RemoveBlockIAL(b.ID)
}
cache.RemoveDocIAL(block.Path)
msg := fmt.Sprintf(Conf.Language(39), rootID)
util.IncBootProgress(bootProgressPart, msg)
util.PushStatusBar(msg)
treenode.RemoveBlockTreesByRootID(block.RootID)
sql.RemoveTreeQueue(block.RootID)
cache.RemoveTreeData(rootID)
sql.RemoveTreeQueue(rootID)
bts := treenode.GetBlockTreesByRootID(rootID)
for _, b := range bts {
cache.RemoveBlockIAL(b.ID)
}
if block := treenode.GetBlockTree(rootID); nil != block {
cache.RemoveDocIAL(block.Path)
}
treenode.RemoveBlockTreesByRootID(rootID)
}
if 1 > len(removeRootIDs) {
@ -341,6 +341,8 @@ func upsertIndexes(upsertFilePaths []string) (upsertRootIDs []string) {
util.IncBootProgress(bootProgressPart, msg)
util.PushStatusBar(msg)
rootID := util.GetTreeID(p)
cache.RemoveTreeData(rootID)
tree, err0 := filesys.LoadTree(box, p, luteEngine)
if nil != err0 {
continue
@ -348,13 +350,13 @@ func upsertIndexes(upsertFilePaths []string) (upsertRootIDs []string) {
treenode.UpsertBlockTree(tree)
sql.UpsertTreeQueue(tree)
bts := treenode.GetBlockTreesByRootID(tree.ID)
bts := treenode.GetBlockTreesByRootID(rootID)
for _, b := range bts {
cache.RemoveBlockIAL(b.ID)
}
cache.RemoveDocIAL(tree.Path)
upsertRootIDs = append(upsertRootIDs, tree.Root.ID)
upsertRootIDs = append(upsertRootIDs, rootID)
}
if 1 > len(upsertRootIDs) {