Frun1na opened a new pull request, #6523:
URL: https://github.com/apache/rocketmq-dashboard/pull/6523
### Which Issue(s) This PR Fixes
- Fixes #6522
### Brief Description
Two mutations on the users page refreshed the list by awaiting the
`loadUsers` captured when the
operator confirmed them — the row status switch (`setEnabled`) and the
session revocation popovers
(`revokeSessions`, from the row and from the drawer). `loadUsers` is a
`useCallback` over the search,
the role and status filters, the page and the page size, and both mutations
leave the page
interactive (`web/src/pages/studio/UserManagement.tsx:302-311`, `:335-357`),
so changing the search or
the page while the request is on the wire made the follow-up refresh
re-issue the old query and write
its rows and total over the newer result — the table then showed rows the
search box no longer
selects. `#6198` fixed the same shape for the two settings tabs.
Both refreshes now bump a `refreshVersion` the list effect depends on
(`web/src/pages/studio/UserManagement.tsx:199-208`), so they run against the
query on screen; the
existing request-sequence guard still decides which response may write, and
a superseded response
cannot change the page. The modal-confirmed paths (create user, password
reset) keep awaiting the
loader: their modals block the page, so the query cannot change while they
run.
User-visible change: a session revocation or status switch that completes
after the operator changed
the search or the page now refreshes the list the operator is looking at
instead of restoring the
previous query's rows. No copy is added.
### How Did You Test This Change?
```
$ cd web && npx eslint src/pages/studio/UserManagement.tsx
src/pages/studio/__tests__/UserManagement.test.tsx
# clean
$ cd web && npx prettier --check src/pages/studio/UserManagement.tsx
src/pages/studio/__tests__/UserManagement.test.tsx
# clean
$ cd web && npx vitest run
src/pages/studio/__tests__/UserManagement.test.tsx --maxWorkers=1
--fileParallelism=false
✓ src/pages/studio/__tests__/UserManagement.test.tsx (16 tests) 12.5s
✓ refreshes the query on screen when a revocation finishes after the
search changes
✓ revokes sessions after row confirmation
✓ debounces username search and sends role and status filters
Test Files 1 passed (1)
Tests 16 passed (16)
$ cd web && npx tsc -b
# clean
```
The new test fails without the fix (this is the mutation check: the two
refresh calls are restored to
the awaited loader, the test is kept):
```
$ cd web && npx vitest run
src/pages/studio/__tests__/UserManagement.test.tsx --maxWorkers=1
--fileParallelism=false
FAIL src/pages/studio/__tests__/UserManagement.test.tsx >
UserManagementPage > refreshes the query on screen when a revocation finishes
after the search changes
AssertionError: expected { search: undefined, …(4) } to deeply equal
ObjectContaining {"search": "current"}
Test Files 1 failed (1)
Tests 1 failed | 15 passed (16)
```
The assertions are the arguments of the last `listStudioUsers` call and the
rows rendered after the
revocation resolves (the narrowed term's row present, the previous row
gone), so they only pass when
the refresh re-queries the term on screen. The existing revocation,
search-debounce and status-switch
cases pin that the refresh still happens and that a pending mutation still
cannot overlap another.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
- [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [ ] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (README / `docs` /
in-app help)
--
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]