Feature 98/move search filterbar #102
No reviewers
Labels
No labels
bug
ci
documentation
duplicate
enhancement
feature
good first issue
help wanted
invalid
performance
priority
P0
priority
P1
priority
P2
question
refactor
size
L
size
M
size
S
size
XL
size
XS
tests
trivial
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
noe.trevino/paso!102
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature-98/move-search-filterbar"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Checklist
CONTRIBUTING.mdgo test ./... -race) locallygofmt -w .andgolangci-lint run ./...respectivelyREADME.mdif applicableSummary
Closes #98
Informational Warning:
The snapshot tests have been changed.
Please add a screenshot showing what has been changed, and a description of why it was changed.
If you do not provide an explanation and screenshot in 3 days, this PR will be closed.
@TheNoeTrevino
Changed snapshot files (11 files)
internal/testing/snapshots/cli/testdata/e2e/task-show.goldeninternal/testing/snapshots/tui/testdata/board_with_labels.goldeninternal/testing/snapshots/tui/testdata/board_with_multiple_tasks.goldeninternal/testing/snapshots/tui/testdata/board_with_tasks.goldeninternal/testing/snapshots/tui/testdata/connection_disconnected.goldeninternal/testing/snapshots/tui/testdata/connection_reconnecting.goldeninternal/testing/snapshots/tui/testdata/empty_project_board.goldeninternal/testing/snapshots/tui/testdata/no_projects.goldeninternal/testing/snapshots/tui/testdata/notification_error.goldeninternal/testing/snapshots/tui/testdata/notification_warning.goldeninternal/testing/snapshots/tui/testdata/project_no_columns.goldenSearchBackspaceslices by bytes, not runes:For a query ending in a multi-byte UTF-8 character (e.g. any non-ASCII input) this will produce a malformed string. Use
[]runeround-tripping:AppendSearchCharenforces the cap withlen(f.SearchQuery)which counts bytes, not characters. A query of 50 two-byte runes already hits the 100-byte limit while only being 50 characters long. Useutf8.RuneCountInString(orlen([]rune(f.SearchQuery))) for a consistent character limit.@ -129,0 +132,4 @@m.UI.Filter.FocusedChip = state.FilterChipSearchm.UI.Filter.SearchInputActive = truem.UI.Filter.SearchQuery = ""m.UIState.Mode = state.FilterBarModeSearchQueryis unconditionally cleared here. Since search now persists across project switches, pressing/to re-open search wipes the active query instead of letting the user edit it. Either pre-populate the input with the existing query, or only clear it if there is no active query.SearchQueryandSearchInputActiveare already accessible throughprops.Filter(the*state.FilterStatepointer passed on the line above). Duplicating them as separateFilterBarPropsfields creates two sources of truth for the same state.RenderFilterBarshould read them directly fromprops.Filterinstead.Review Summary
The refactor is coherent and the consolidation of
SearchStateintoFilterStateis the right direction. Four concrete issues found:1. Byte-level backspace (correctness bug)
SearchBackspacetruncates viaf.SearchQuery[:len(f.SearchQuery)-1]. For any non-ASCII character (multi-byte UTF-8 rune) this produces a malformed string or panics. Must use rune-level slicing. See inline comment onfilter_state.go.2. Byte-based max-length check (correctness bug)
AppendSearchCharguards withlen(f.SearchQuery) >= maxSearchQueryLengthwhich counts bytes. The effective character limit is inconsistent for non-ASCII input (50 two-byte characters = 100 bytes = limit hit). Useutf8.RuneCountInString. See inline comment onfilter_state.go.3. Pressing
/discards an active search query (behaviour regression)handleEnterSearchChipunconditionally setsSearchQuery = "". Search now persists across project switches by design, but pressing/to refine an existing search destroys it. The query should either be preserved for editing, or only cleared when there is no active query. See inline comment onupdate_normal.go.4. Duplicate state fields in
FilterBarProps/view_board.go(design issue)SearchQueryandSearchInputActiveare set redundantly inbuildFilterBarPropseven though the same values are already accessible viaprops.Filter(the*state.FilterStatepointer). This creates two sources of truth for the same state and unnecessary indirection. See inline comment onview_board.go.Score: 6/10