summaryrefslogtreecommitdiffstats
path: root/src/core.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2023-04-29 21:27:30 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2023-04-30 18:14:40 +0900
commit77f9f4664ac9002358735f152ea429e2a578aee2 (patch)
treef14e6149f252cacced75428aa5a0ac87a1c12e06 /src/core.go
parent5c2f85c39e98d6fcf70cbc887de7a1af1b0d9c52 (diff)
Fix search not triggered when query change and reload happen at the same time
Fix #3268
Diffstat (limited to 'src/core.go')
-rw-r--r--src/core.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core.go b/src/core.go
index a4751a55..d4c06f9f 100644
--- a/src/core.go
+++ b/src/core.go
@@ -299,10 +299,12 @@ func Run(opts *Options, version string, revision string) {
case EvtSearchNew:
var command *string
+ var changed bool
switch val := value.(type) {
case searchRequest:
sort = val.sort
command = val.command
+ changed = val.changed
if command != nil {
useSnapshot = val.sync
}
@@ -314,10 +316,17 @@ func Run(opts *Options, version string, revision string) {
} else {
restart(*command)
}
+ }
+ if !changed {
break
}
if !useSnapshot {
- snapshot, _ = chunkList.Snapshot()
+ 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 := !useSnapshot && clearCache()
matcher.Reset(snapshot, input(reset), true, !reading, sort, reset)