Frun1na opened a new pull request, #4818:
URL: https://github.com/apache/rocketmq-dashboard/pull/4818
### Which Issue(s) This PR Fixes
- Fixes #ISSUE_ID
### Brief Description
The Ops configuration load effect in `web/src/pages/studio/Ops.tsx` depends
on `fetchFailedMessage`,
a string derived from `t('ops.fetchFailed')`, so switching the display
language in the top bar re-runs
it — and the re-run ended with an unconditional reset of the NameServer
selection:
```tsx
setSelectedNamesrv(data.currentNamesrv);
```
An operator who picked a NameServer from the list but has not saved it yet
loses that selection by
merely switching the language, and the page silently points back at the
stored current NameServer
while the select still looks editable. This is the same root cause #4590
fixed for the instance
selection in `BrokerCluster.tsx` (`t`-derived effect dependency +
unconditional setter); `Ops.tsx`
was the remaining unguarded selection of that shape.
The setter is now functional: the unsaved selection is kept while it still
appears in the freshly
loaded address list and falls back to the stored current NameServer
otherwise, so first load,
deletion fallback and refetch-after-failure behave exactly as before.
### How Did You Test This Change
TDD: a new `OpsPage` test renders the page with a language-switch button
(the pattern the #4590 tests
introduced), picks the second NameServer from the list, switches the
language and asserts the select
still shows the unsaved pick. Before the fix it fails — the select snaps
back to
`127.0.0.1:9876` — and after the fix:
```
npx vitest run src/pages/studio/__tests__/Ops.test.tsx
Test Files 1 passed (1)
Tests 8 passed (8)
```
`tsc --noEmit` and `eslint` on the changed files are clean.
--
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]