btlqql opened a new pull request, #5347:
URL: https://github.com/apache/rocketmq-dashboard/pull/5347

   ### Which Issue(s) This PR Fixes
   
   - Fixes #5125
   
   ### Brief Description
   
   `loadSubscriptions` in `web/src/pages/instance/consumer.tsx` raised the 
per-group loading flag for
   a user-visible subscription check but cleared it only while the finishing 
request was **both** the
   newest and non-silent (`if (… === requestId && !silent)`, line 415 before 
this change). The
   consumer-group detail modal re-checks subscriptions silently every 2 
seconds, so a tick that landed
   while a user-visible check (opening the modal, the 健康诊断 tab, 重新检查) was still 
in flight took
   over the request slot: the older request was no longer current and the 
silent one was excluded by
   `!silent`, so neither of them could clear 
`subscriptionLoadingByGroup[cacheKey]`. The
   订阅一致性检查 panel then kept spinning — and could keep claiming 正在检查订阅一致性 with an 
empty
   table — until the operator triggered another non-silent check.
   
   The newest request for a group now owns the loading flag whichever way it 
was started; the id check
   that drops superseded responses is unchanged, so the behaviour #4968 
established (a stale response
   must not publish its result) still holds.
   
   ### How Did You Test This Change?
   
   Two new cases in `web/src/pages/instance/__tests__/ConsumerPage.test.tsx` 
open the detail modal with
   a deferred user-visible subscription request, let the modal's 2s 
auto-refresh issue its silent
   request (`getConsumerSubscriptions` has been called twice), settle both in 
the two possible orders
   and assert that the 重新检查 button is no longer in `ant-btn-loading`. They were 
run first on the
   unmodified tree (red) and then after the fix (green), and 
`ConsumerPageDiagnosticsRace.test.tsx`
   (the staleness suite the issue names) still passes.
   
   ```
   $ cd web && npx vitest run 
src/pages/instance/__tests__/ConsumerPage.test.tsx -t 'stops the subscription 
check spinner'
   
   # before the fix
    × stops the subscription check spinner when the superseding silent refresh 
settles last 13012ms
    × stops the subscription check spinner when the superseded user-visible 
check settles last 10025ms
   Error: expect(element).not.toHaveClass("ant-btn-loading")
   Expected the element not to have class:
     ant-btn-loading
   Received:
     ant-btn css-dev-only-do-not-override-mncuj7 ant-btn-default 
ant-btn-color-default ant-btn-variant-outlined ant-btn-sm ant-btn-loading
    Test Files  1 failed (1)
         Tests  2 failed | 39 skipped (41)
   
   # after the fix
   $ cd web && npx vitest run 
src/pages/instance/__tests__/ConsumerPage.test.tsx \
         src/pages/instance/__tests__/ConsumerPageDiagnosticsRace.test.tsx
    Test Files  2 passed (2)
         Tests  42 passed (42)      # 39 pre-existing cases + the 2 new ones + 
the race suite
   ```
   
   Note on the runner, for honesty: this suite drives real 2s intervals. One 
earlier run of the same
   two-file command took 353s instead of 149s on a loaded machine and produced 
four unrelated timing
   failures — for example `keeps the latest client stack when an older request 
resolves last`, which
   does not touch the subscription loading flag at all. The rerun in the same 
configuration passed
   fully, as quoted above, and `ConsumerPage.test.tsx` alone is also green (41 
passed).
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits
   - [x] Tests added or updated for non-trivial changes
   - [ ] New UI text has both Chinese and English entries under `web/src/i18n/` 
— not applicable: the
         change adds no user-facing string
   - [x] Architecture constraints stay green — no `server/**` file is touched, 
so the ArchUnit checks
         are unaffected; the frontend gates for the touched files are green
   - [ ] New source files carry the ASF license header — not applicable: no new 
source file
   - [ ] Documentation touched where behaviour changed — not applicable: no 
document describes the
         diagnostic modal's loading state
   


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