unbridled-41 opened a new pull request, #3301: URL: https://github.com/apache/rocketmq-dashboard/pull/3301
# PR 4 — fix(topic): search topics with the trimmed term on the client too ## Problem / Evidence The topic list fetches with `search: searchText.trim()` (`loadTopicPage`) but passes the raw input to the client-side row filter `visibleTopics`, which does `topic.name.toLowerCase().includes(searchText.toLowerCase())`. A search term with leading/trailing whitespace (e.g. from a paste) 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. Regression test added: `keeps matching rows when the search term has leading or trailing spaces` — red on pristine (row disappears after submitting " orders "), green after the fix. ## Root cause / Fix Two different search terms are in play: the trimmed one used for the server query and the raw one used for client re-filtering. Fix: trim once when the term is stored in `onSearch` (`setSearchText(value.trim())`), so the server query, the client filter, and the export all use the same effective term. Precedent: closed issue #911 fixed the same defect class for consumer-group search. ## Priority & scoring PRIORITY 72 = 影响 26 (primary search interaction on the topic page returns an empty table for padded input) + 波及范围 12 (topic page) + 可复现性 19 (deterministic, trivial steps) + 维护价值 15 (single normalization point). FIX_CONFIDENCE 90. ## Tests - `npx vitest run src/pages/instance/__tests__/TopicPage.test.tsx` → 22/22 (new test red on pristine, green after fix). - Full web suite + build + tsc/eslint: see comment below. ## Risk Low. Only the stored search term changes; the input box itself still displays what the user typed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
