zmuxuny opened a new pull request, #4490:
URL: https://github.com/apache/rocketmq-dashboard/pull/4490
### Which Issue(s) This PR Fixes
- Fixes #4489
### Brief Description
Restore the instance-scoped lifecycle boundary for the Topic page. Current
`master` keeps Topic state mounted while the selected managed instance changes,
so a mutation target captured from instance A can remain visible after instance
B is selected. The edit path then builds its request with the current
`selectedInstanceId`, which can submit A's stale form against B when both
instances contain the same Topic name.
The fix moves the existing Topic page body into `TopicPageContent` and keys
that content by `selectedInstanceId`. Switching instances therefore discards
the previous instance's edit/detail/send/import/sync/selection state before the
new inventory becomes actionable. No Topic API or Broker behavior changes.
This restores behavior previously tracked by #1720 and merged as part of
#2308; current `master` no longer contained the keyed remount, so #4489 records
the regression explicitly.
### Fail-before evidence
Baseline: `master@987b748e8f4f421c5cd3c4c4e51a064cc7e59f18`.
The new regression opens `topic-a`'s edit dialog on instance A, switches the
page to instance B and waits until `topic-b` is loaded. On the unmodified
baseline it fails because the stale dialog remains mounted:
```text
expected document not to contain element, found:
<div class="ant-modal-title">编辑 Topic</div>
```
The page itself already shows `instance-b` at the same time, proving that
the mutation UI and the selected write scope have diverged.
### How Did You Test This Change?
- `npx vitest run src/pages/instance/__tests__/TopicPage.test.tsx`
- **27 tests passed, 0 failures**.
- Focused red/green regression:
- baseline: failed because the A edit dialog survived the switch to B;
- fixed: passed and `updateTopic` remained uncalled.
- `npx eslint src/pages/instance/topic.tsx
src/pages/instance/__tests__/TopicPage.test.tsx`
- **0 errors**.
- `npm run build`
- TypeScript and Vite production build passed; **8046 modules
transformed**.
- `git diff --check`
- passed.
The Vitest run still prints existing jsdom `getComputedStyle` and AntD
`Descriptions` warnings from unrelated cases; all 27 tests pass.
### Checklist
- [x] One coherent defect fix; no unrelated changes
- [x] Commit subject follows Conventional Commits and references the issue
- [x] Regression test added and demonstrated red before / green after
- [x] No new UI text or dependency
- [x] No public API, persistence or Broker protocol change
- [x] Production build and changed-file lint pass
AI-assisted analysis, patch and regression authoring; all red/green and
build commands above were executed locally against the stated baseline.
--
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]