You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "unbridled-41 (via GitHub)" <gi...@apache.org> on 2026/09/20 07:13:13 UTC
[I] [Studio][Bug] General settings discard unsaved input when the display language changes [rocketmq-dashboard]
unbridled-41 opened a new issue, #4587:
URL: https://github.com/apache/rocketmq-dashboard/issues/4587
## Problem
On `/settings` (通用设置 tab) the page loads the settings record once and fills the notification and security forms from that snapshot. That load effect lists the translation function `t` as a dependency, and `t` is recreated whenever the display language changes (`web/src/i18n/LangContext.tsx`). Switching the language through the top-bar toggle therefore re-runs the effect and repopulates both forms from the server — silently discarding everything the operator had typed but not yet saved.
Steps to reproduce:
1. Open `/settings`, 通用设置 tab.
2. Edit the DingTalk webhook (or 邮件接收人 / 会话超时) without saving.
3. Switch the display language with the top-bar toggle.
4. The field reverts to the server value; no message is shown and the edit is lost.
## Studio Version
branch: master
git commit id: d50ffecc9d7e8f8f46da64198831bd7952e6974e
deployed as: built from source (frontend only)
## Evidence
- `web/src/pages/settings/GeneralSettingsTab.tsx:100` — the effect's dependency list is `[message, notifyForm, securityForm, t]`, while the effect body calls `securityForm.setFieldsValue(...)` and `notifyForm.setFieldsValue(...)` (`:81-:88`). `Form.useForm()` and `App.useApp().message` are stable, so `t` is the only dependency that forces a re-run.
- Regression test `web/src/pages/settings/__tests__/GeneralSettingsFormResidue.test.tsx` switches the language through the real `LangProvider.setLang` and fails on `master`:
```
FAIL src/pages/settings/__tests__/GeneralSettingsFormResidue.test.tsx > GeneralSettingsTab unsaved input > keeps unsaved notification edits when the display language changes
Error: expect(element).toHaveValue(...)
Expected the element to have value:
https://oapi.dingtalk.com/robot/send?access_token=edited
Received:
https://oapi.dingtalk.com/robot/send?access_token=server
❯ src/pages/settings/__tests__/GeneralSettingsFormResidue.test.tsx:108:21
Test Files 1 failed (1)
Tests 1 failed (1)
```
## Impact
An operator who switches the display language while configuring notification channels loses the values they were about to save — for example a DingTalk signing secret or a new recipient list — with no warning and no way to recover them from the page.
## Expected behavior
Changing the display language re-renders text only. Editor content that the user has typed but not saved must survive it, as it does in the sibling tabs that load once per mount.
## Related work
- In-repo precedent for decoupling the load effect from the translation function: `web/src/pages/studio/LiteTopic.tsx:126-161` and the follow-up in #2200 (merged) keep a `translationRef`/`messageRef` pair and load with mount-only deps.
- #4284 (merged) — the same settings record must not lose fields a user has not edited; this issue is the client-side twin (input a user has not saved).
## PR
Fix: #PR_PLACEHOLDER.
--
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: commits-unsubscribe@rocketmq.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Studio][Bug] General settings discard unsaved input when the display language changes [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed issue #4587: [Studio][Bug] General settings discard unsaved input when the display language changes
URL: https://github.com/apache/rocketmq-dashboard/issues/4587
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Studio][Bug] General settings discard unsaved input when the display language changes [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on issue #4587:
URL: https://github.com/apache/rocketmq-dashboard/issues/4587#issuecomment-5928840938
Resolved by #4588 (merged into rocketmq-studio as 0565bbc04).
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Studio][Bug] General settings discard unsaved input when the display language changes [rocketmq-dashboard]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #4587:
URL: https://github.com/apache/rocketmq-dashboard/issues/4587#issuecomment-5748849554
## 🤖 AI Assessment
**Type:** bug | **Status:** Confirmed
The reported issue has been verified against the current codebase.
**Root Cause:** The load effect in `GeneralSettingsTab.tsx` lists the translation function `t` as a dependency. Since `t` is recreated whenever the display language changes (via `LangContext.tsx`), switching language re-runs the effect and repopulates both forms from the server snapshot — silently discarding unsaved operator input.
**Impact:** Operators editing settings (DingTalk webhook, email recipients, session timeout) will lose their unsaved edits if they switch the display language before saving. No error message is shown.
**Severity:** Medium — data loss (unsaved edits) without any user-visible warning.
**Suggested Fix:** Remove `t` from the effect dependency array, or guard the effect so it only repopulates form values on initial mount / data refetch (not on language change). Alternatively, use `useRef` to track whether the form has been populated and skip re-population on subsequent effect runs.
---
*Automated evaluation by github-manager bot. A maintainer will review this shortly.*
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org