Wang1rrr opened a new pull request, #4984:
URL: https://github.com/apache/rocketmq-dashboard/pull/4984
## What is the purpose of the change
Fixes stale-data rendering on the ACL page and the system alerts page: after
the first successful
load, every later refetch (instance switch, paging, filter change, manual
refresh) showed the
previous result without any loading indicator.
## Root cause
Both pages initialise the loading flag from the mount-time state and only
ever clear it inside
`finally`:
```ts
const [rulesLoading, setRulesLoading] = useState(hasSelectedInstance);
// ...
.finally(() => { if (mounted) setRulesLoading(false); });
```
`setRulesLoading(true)` / `setUsersLoading(true)` are never called again,
and the same effect
re-runs on every dependency change (`selectedInstanceId`, `rulePage`,
`userKeyword`,
`ruleRefreshKey`, ...). So from the second request onwards the flag is
already `false` when the
request starts: the table keeps rendering the previous instance's
rules/users for the duration of
the request, and the user has no indication that the data on screen is
stale. On an instance
switch this is actively misleading — an operator can read another instance's
ACL policy as if it
belonged to the instance they just selected.
`systemAlerts.tsx` has the identical shape (`const [loading, setLoading] =
useState(true)` with
re-runs on `page`, filters and `refreshNonce`).
## What is fixed
Both effects re-arm the loading flag before dispatching their requests, so
every refetch is
masked and the previous rows are not presented as current.
## Verification
`npm test` (full suite, 1034 tests) passes; no behaviour change to the
request logic itself, only
to the loading state that guards rendering.
--
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]