You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "unbridled-41 (via GitHub)" <gi...@apache.org> on 2026/09/05 08:18:26 UTC

[PR] fix(topic): search topics with the trimmed term on the client too [rocketmq-dashboard]

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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(topic): search topics with the trimmed term on the client too [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #3301:
URL: https://github.com/apache/rocketmq-dashboard/pull/3301


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(topic): search topics with the trimmed term on the client too [rocketmq-dashboard]

Posted by "unbridled-41 (via GitHub)" <gi...@apache.org>.
unbridled-41 commented on PR #3301:
URL: https://github.com/apache/rocketmq-dashboard/pull/3301#issuecomment-5550559522

   补充完整验证记录(本地沙箱;因上游 CI 对所有分支 startup_failure——工作流未启动——无法依赖 CI):
   
   - 新回归测试先红后绿:pristine 上提交 " orders " 后 orders-topic 从表格消失(`findByText('orders-topic')` 失败——服务端返回了匹配行、客户端过滤全部滤除);修复后 `npx vitest run src/pages/instance/__tests__/TopicPage.test.tsx` 22/22 通过。
   - 全量前端套件(`npx vitest run --testTimeout=60000`):923 tests,1 失败 = `ConsumerPage.test.tsx` "shows group health diagnostics..."(本沙箱已证实的负载脆弱文件,PR #3156 验证时同样失败);TopicPage 全部通过。本次修改未触碰 ConsumerPage。
   - `npm run build` ✓(等价 CI frontend-build);`npx tsc --noEmit` 干净;`npx eslint` 两个改动文件干净。
   - git diff 自检:仅 topic.tsx onSearch 一处 trim + 1 个新测试,无无关改动。
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org