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

   Fixes #7151
   
   ## Problem
   
   ConsumerPageContent is already keyed by instance, but its four mutation 
confirmation flows use static Ant Design dialogs. Those roots survive the page 
that created them. After browser-history navigation or an instance change, a 
retained confirmation can still delete groups, create a group, or change 
high-risk consumption settings against the previous instance. The dialogs only 
identify a group/count.
   
   ## Change
   
   - Create the confirmation API with Modal.useModal and mount its holder 
inside the instance-keyed page.
   - Invalidate the page's confirmation generation and settings request owner 
on cleanup, including work that is still validating a form.
   - Ignore abandoned confirmation callbacks and late mutation completions 
before they start a follow-up list request or update a replaced page.
   - Keep ownership local: do not globally destroy dialogs created by another 
page.
   - Exercise the existing consumer tests through real dialogs instead of 
static confirmation spies. Disable test-only motion so consecutive 
confirmations do not depend on jsdom transition completion.
   
   Backend APIs, mutation payloads, confirmation wording and current-page 
confirmation behavior are unchanged. Already-dispatched mutations are not 
cancelled; their abandoned-page continuations are ignored.
   
   ## Validation
   
   The new regression tests use the actual ConsumerPage, useInstanceFilter, 
React Router and AntD dialogs. Services are mocked at their boundary; no live 
resources are mutated.
   
   On unchanged production code at 127c47b06a268cc74224d5f34c56ec7c36ac0d55, 
the final 16-test file produces **12 failures and 4 passing controls**. The 
controls exercise normal single delete, batch delete, create and settings 
confirmation. The failures cover route exit, old-instance requests after 
switching to an identically named group, delayed form validation, preserving an 
unrelated dialog while disposing the consumer dialog, and late mutation 
completion refreshing the old instance.
   
   After the fix, the same 16 tests and the complete related files pass: **6 
files, 125 tests** (one Vitest worker):
   - ConsumerConfirmationOwnership.test.tsx
   - ConsumerPage.test.tsx
   - ConsumerPageDiagnosticsRace.test.tsx
   - consumerService.test.ts
   - metadata.test.ts
   - useInstanceFilter.test.tsx
   
   Also passed:
   - Forced TypeScript build (`tsc -b --force --pretty false`)
   - Full frontend ESLint (zero errors; ten existing warnings in unchanged 
files)
   - Prettier check of all three changed files and `git diff --check`
   - `npm run build`, including Vite and the distribution license check (132 
components, 139 license files)
   
   The full frontend test suite and backend tests were not run for this 
frontend-only change.
   
   ## Related work checked
   
   Searched issues and PRs across all states and inspected near-match patches. 
#1707 and #4490 introduce keyed component boundaries, which cannot dispose an 
unrelated static modal root. #6531/#7046 handle deletion error feedback. #6182 
refreshes the consumption-settings risk baseline. Their patches do not scope 
these confirmations to the owning page.
   


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