apache / apache/rocketmq-dashboard

[Studio][Bug] User inventory CSV export uses the live search input instead of the committed query

Open
#4,262 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
683
Avg merge
2d 12h
Merged PRs (30d)
62

Description

[Studio][Bug] User inventory CSV export uses the live search input instead of the committed query

## Problem

The studio user management page loads its table from a debounced (committed) search, but the "导出" (export) button builds its query from the **live** input value. Typing a refinement and clicking export within the 300 ms debounce window (or while the matching refetch is still in flight) downloads a CSV for a search the displayed table never showed.

## Evidence

- `web/src/pages/studio/UserManagement.tsx` at 6c24d2ed: the table fetch uses `search: debouncedSearch || undefined` (line 134, fed by the debounce effect at lines 114-117), while `handleExportUsers` sends `search: search.trim() || undefined` (line 268) with the live `search` in its dependency array (line 282).
- Regression test red on current code: after the debounce settles on `alpha`, typing `-beta` and immediately clicking export makes the export API receive `search: "alpha-beta"` while the table still shows the `alpha` results. The export callback also resolves with whatever the live state is at click time, so an in-flight refetch is bypassed the same way.
- Sibling pages already do this correctly - `ops/audit.tsx` exports from `debouncedSearchText`, `settings/CloudCredentialTab.tsx` and `settings/DataSourceTab.tsx` export from their `debouncedSearch` - so the user inventory export is the odd one out.

## Impact

The exported user inventory is the audit/compliance artifact of this page; with the bug it can silently contain rows for a query the operator never saw displayed (e.g. a typo still in the input, or a term the debounced fetch has not committed yet).

## Expected behavior

The export should use the committed (debounced) search value - the same query the visible table was loaded with - mirroring the sibling pages and the committed-query semantics already established on the message page.

## Related work

- #4009 / merged fix established "act against the committed query, not live inputs" for the message page pagination; this is the export-side twin on the user inventory page.

## PR

Fix: #4263.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in web/src/pages/studio/UserManagement.tsx, comparing the table's debounced query with handleExportUsers and the sibling export implementations. Reproduce the described timing case or run the mentioned regression test; done means export receives the committed query, such as alpha, rather than the live input, such as alpha-beta.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.