Skip to content

Commit

Permalink
Don't check filter input value for each row (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evertras committed Mar 28, 2023
1 parent cac6a97 commit c270555
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions table/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import (
)

func (m Model) getFilteredRows(rows []Row) []Row {
if !m.filtered || m.filterTextInput.Value() == "" {
filterInputValue := m.filterTextInput.Value()
if !m.filtered || filterInputValue == "" {
return rows
}

filteredRows := make([]Row, 0)

for _, row := range rows {
if isRowMatched(m.columns, row, m.filterTextInput.Value()) {
if isRowMatched(m.columns, row, filterInputValue) {
filteredRows = append(filteredRows, row)
}
}
Expand Down

0 comments on commit c270555

Please sign in to comment.