apache / apache/rocketmq-dashboard

ACL user inventory goes stale after create and delete (no server-page refresh)

Open
#3,306 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

## Problem

On the ACL page 用户管理 tab, creating or deleting a user only mutates the local page array. The server-paginated total is never updated and no refetch is triggered, so:

- Creating a user with a full page prepends the new row and silently pushes the previously-last row out of view; the pagination total keeps its stale value.
- Deleting the last row on the last page leaves an empty page: the total stays too high, and the empty-page auto-correction (which lives inside the fetch effect) never runs because nothing refetches.

## Evidence / source

- Code inspection of the current `rocketmq-studio` branch (base commit 36126024): `acl.tsx` `handleUserSubmit` (create branch, `setUsers((prev) => [normalizeUser(created), ...prev])`) and `handleDeleteUser` (`setUsers((prev) => prev.filter(...))`) touch neither `userTotal` nor any refresh key, while the sibling rules tab bumps `ruleRefreshKey` after its mutations.
- Deterministic Vitest reproduction in `AclPage.test.tsx`: `reloads the server user page after creating an ACL user` and `reloads the server user page after deleting one ACL user` both fail on the unfixed source (`pageAclUsers` called once instead of twice).

## Impact

Wrong pagination totals, rows that disappear from view after create, and an unrecoverable empty page after deleting the last row on the last page — until the user manually changes the page or refetches.

## Expected behavior / acceptance criteria

- After a successful user create or delete, the authoritative server page is reloaded (same pattern as the rules tab).
- Pagination totals stay synchronized with the server.
- An emptied page falls back to the previous page via the existing correction logic.
- Regression coverage for both mutation paths; they must fail on the unfixed code.

## Related work

- #2680 (closed) fixed the same defect class for Topic and Consumer Group deletion; the ACL user inventory was outside that scope and also exposes the create-path symptom.

## PR

PR #3300 (includes the fix and two regression tests).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in acl.tsx by reading handleUserSubmit and handleDeleteUser, then run the two named Vitest cases in AclPage.test.tsx. Compare the user-tab behavior with the sibling rules-tab refresh pattern. Done means both mutation paths reload the server page, totals stay current, and deleting the last row allows the existing empty-page correction to run.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.