Delete stale dircache entry during rename (#1138)

* Delete stale dircache entry during rename

* Clear `regCache` as well

* Add comment
This commit is contained in:
Joe Lim authored and GitHub committed 2023-03-12 15:11:09 +03:00
1 parent 382534c4ba
commit bcd058ace2
1 file changed
+6
+6
View File
@@ -1434,6 +1434,12 @@ func (nav *nav) rename() error {
return err
}
// It is possible for newPath to already have cache entries if it previously
// existed and was deleted. In this case the cache entries should be deleted
// before loading newPath to prevent displaying a stale preview. However,
// this clears only the current instance of lf, and not any other instances.
delete(nav.regCache, newPath)
delete(nav.dirCache, newPath)
dir := nav.loadDir(filepath.Dir(newPath))
if dir.loading {