apache / apache/rocketmq-dashboard
Topic list search empties the table for search terms with leading or trailing spaces
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 683
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 58
Description
## Problem
The topic list's search box trims the term only for the server query. `loadTopicPage` fetches with `search: searchText.trim()`, but the client-side row filter `visibleTopics` receives the raw input and matches with `topic.name.toLowerCase().includes(searchText.toLowerCase())`. A search term with leading or trailing whitespace (easy to get from a paste) therefore queries the server with the trimmed term, receives the matching topics, then filters every returned row out because no topic name contains the padded string — the table shows empty despite matches existing.
## Evidence / source
- Code inspection of the current `rocketmq-studio` branch (base commit 36126024): `web/src/pages/instance/topic.tsx` — `loadTopicPage` trims (`:433`), `filteredTopics` passes the raw `searchText` to `visibleTopics` (`:484`), the filter itself at `:178`; `onSearch` stores the raw value (`:1464-1467`).
- Deterministic Vitest reproduction in `TopicPage.test.tsx`: `keeps matching rows when the search term has leading or trailing spaces` fails on the unfixed source (the matching row disappears after submitting " orders ").
## Impact
The primary search interaction on the topic page returns an empty table for padded input, even though the server returned matching topics.
## Expected behavior / acceptance criteria
- The trimmed search term is used consistently by the server query, the client-side row filter, and the export, so rows matching the trimmed term remain visible.
- Regression coverage for a padded search term; it must fail on the unfixed code.
## Related work
- #911 (closed) fixed the same defect class for consumer-group search; the topic page retains the trim mismatch.
## PR
PR #3301 (includes the fix and the regression test).
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue identifies web/src/pages/instance/topic.tsx and TopicPage.test.tsx; start by running the named Vitest regression test and reviewing PR #3301. Done means padded search terms keep matching rows visible, with the trimmed term used consistently for querying, filtering, and export, and regression coverage in place.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100