Fix caching when reload and query change triggered by the same binding

This commit is contained in:
Junegunn Choi
2023-05-01 13:53:34 +09:00
parent fb76893e18
commit b7c2e8cb67
3 changed files with 24 additions and 1 deletions

View File

@@ -320,15 +320,16 @@ func Run(opts *Options, version string, revision string) {
if !changed {
break
}
reset := false
if !useSnapshot {
newSnapshot, _ := chunkList.Snapshot()
// We want to avoid showing empty list when reload is triggered
// and the query string is changed at the same time i.e. command != nil && changed
if command == nil || len(newSnapshot) > 0 {
snapshot = newSnapshot
reset = clearCache()
}
}
reset := !useSnapshot && clearCache()
matcher.Reset(snapshot, input(reset), true, !reading, sort, reset)
delay = false