Fix TUI code that tracked whether a search query is pending so it doesn't show the pending message when no query is pending

This commit is contained in:
David Dworken 2023-12-09 15:51:04 -08:00
parent 8419a883b4
commit 2d2c393bf9
No known key found for this signature in database

View File

@ -285,8 +285,8 @@ func runQueryAndUpdateTable(m model, forceUpdateTable, maintainCursor bool) tea.
if m.runQuery != nil {
query = *m.runQuery
}
LAST_DISPATCHED_QUERY_ID++
queryId := LAST_DISPATCHED_QUERY_ID
LAST_DISPATCHED_QUERY_ID += 1
LAST_DISPATCHED_QUERY_TIMESTAMP = time.Now()
return func() tea.Msg {
rows, entries, searchErr := getRows(m.ctx, hctx.GetConf(m.ctx).DisplayedColumns, query, PADDED_NUM_ENTRIES)
@ -799,8 +799,8 @@ func TuiQuery(ctx context.Context, initialQuery string) error {
p := tea.NewProgram(initialModel(ctx, initialQuery), tea.WithOutput(os.Stderr))
// Async: Get the initial set of rows
go func() {
queryId := LAST_DISPATCHED_QUERY_ID
LAST_DISPATCHED_QUERY_ID++
queryId := LAST_DISPATCHED_QUERY_ID
LAST_DISPATCHED_QUERY_TIMESTAMP = time.Now()
rows, entries, err := getRows(ctx, hctx.GetConf(ctx).DisplayedColumns, initialQuery, PADDED_NUM_ENTRIES)
if err == nil || initialQuery == "" {