unbridled-41 opened a new pull request, #4263:
URL: https://github.com/apache/rocketmq-dashboard/pull/4263

   Fixes #4262.
   
   ## Problem / Evidence
   
   The studio user inventory loads its table from a debounced (committed) 
search (`listStudioUsers` receives `search: debouncedSearch || undefined`, 
UserManagement.tsx:134), but the "导出" (export) button rebuilt its query from 
the **live** input value (`search: search.trim() || undefined`, 
UserManagement.tsx:268, with the live `search` in its dependency array at line 
282). Typing a refinement and clicking export within the 300 ms debounce window 
- or while the matching refetch is still in flight - downloaded a CSV for a 
search the displayed table never showed.
   
   Regression test red on 6c24d2ed: after the debounce settles on `alpha`, 
refining the input to `alpha-beta` and exporting synchronously makes the export 
API receive `search: "alpha-beta"` while the table still shows the `alpha` 
results. Sibling pages already do this correctly: `ops/audit.tsx` exports from 
`debouncedSearchText`, `settings/CloudCredentialTab.tsx` and 
`settings/DataSourceTab.tsx` from their `debouncedSearch`.
   
   ## Root cause / Fix
   
   `handleExportUsers` now sends `search: debouncedSearch || undefined` - the 
committed value the visible table was loaded with - and reads `debouncedSearch` 
(instead of `search`) in its dependency array. This is the export-side twin of 
the committed-query semantics established by #4005 for the message page 
pagination.
   
   ## Priority & scoring
   
   PRIORITY 70 = 影响 26(导出物是本页的审计/清单工件,内容与用户所见列表不一致且静默发生)+ 波及 11(仅本页导出按钮)+ 可复现 
18(防抖窗口内"输入→导出"是常规操作序列,确定性复现)+ 维护价值 15(#4005 
既有语义的导出孪生,三个兄弟页已正确,一致性收敛)。FIX_CONFIDENCE 95:单值替换 + 依赖数组同步,行为由兄弟页与既有测试共同锚定。
   
   ## Tests
   
   - New regression `UserManagementPage > exports users matching the committed 
search, not live input` is deterministic: after the committed search is 
awaited, the refinement and the export click run inside one synchronous `act` 
block so the 300 ms debounce cannot commit in between (a first draft that raced 
the real 300 ms timer proved load-fragile under the full suite and was 
rewritten before commit). Red on unfixed code (`Tests run: 7, 1 failed` - 
export received `alpha-beta`) and green after the fix (`7 passed`), verified by 
stashing the fix.
   - Module suite: `UserManagement.test.tsx` **7/7 passed** (re-run after the 
lint-staged reformat).
   - Full web suite on this branch (`npx vitest run`): **982 tests, 979 passed, 
3 failures** - all in untouched files from the known load-fragile family 
(`MetricsExplorer.test.tsx` ×1, `ConsumerPage.test.tsx` ×2); both files pass 
isolated (**25/25** and **31/31**). My test passes in the full run.
   - `tsc -b` clean, `eslint` clean on both touched files, `npm run build` 
succeeds (built in 9.67s).
   
   ## Risk
   
   Low: one-value change scoped to the export handler; filtering semantics 
(`admin`/`enabled`) untouched. Users who typed a new term and waited for the 
table to refresh see identical behavior; only the stale-window export changes, 
from "unseen query" to "displayed query".
   


-- 
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]

Reply via email to