This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch rocketmq-studio
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/rocketmq-studio by this push:
new 0c9bd9b7d fix(web): correct the duplicate property warning in the
payload preview (#4663)
0c9bd9b7d is described below
commit 0c9bd9b7d92551de1c55491000c2ddf1355e5f1c
Author: Apulupie <[email protected]>
AuthorDate: Thu Oct 1 18:22:08 2026 +0800
fix(web): correct the duplicate property warning in the payload preview
(#4663)
Co-authored-by: Frun1na <[email protected]>
---
web/src/pages/instance/__tests__/TopicPage.test.tsx | 2 +-
web/src/utils/messagePayloadPreview.test.ts | 3 ++-
web/src/utils/messagePayloadPreview.ts | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/web/src/pages/instance/__tests__/TopicPage.test.tsx
b/web/src/pages/instance/__tests__/TopicPage.test.tsx
index 31f7f4196..30aded4d5 100644
--- a/web/src/pages/instance/__tests__/TopicPage.test.tsx
+++ b/web/src/pages/instance/__tests__/TopicPage.test.tsx
@@ -1117,7 +1117,7 @@ describe('TopicPage', () => {
await waitFor(() =>
expect(within(dialog).getByText('阻止发送')).toBeInTheDocument());
expect(within(dialog).getByText('属性名重复')).toBeInTheDocument();
-
expect(within(dialog).getByText('重复属性会覆盖前面的值:traceId')).toBeInTheDocument();
+
expect(within(dialog).getByText('重复属性仅保留第一个值:traceId')).toBeInTheDocument();
await user.click(within(dialog).getByRole('button', { name: /发\s*送/ }));
diff --git a/web/src/utils/messagePayloadPreview.test.ts
b/web/src/utils/messagePayloadPreview.test.ts
index 813f56d43..43919b942 100644
--- a/web/src/utils/messagePayloadPreview.test.ts
+++ b/web/src/utils/messagePayloadPreview.test.ts
@@ -117,7 +117,7 @@ describe('messagePayloadPreview', () => {
expect(scalarPreview.issues.map((issue) =>
issue.code)).toEqual(['SCALAR_JSON_BODY']);
});
- it('reports duplicate form properties before they can overwrite earlier
values', () => {
+ it('reports duplicate form properties and keeps only the first value', () =>
{
const result = buildMessagePropertiesFromRows([
{ key: 'traceId', value: 'first' },
{ key: 'tenant', value: 'demo' },
@@ -134,6 +134,7 @@ describe('messagePayloadPreview', () => {
severity: 'error',
names: ['traceId'],
});
+ expect(result.issues[0].description).toContain('仅保留第一个值');
});
it('reports form property values that do not have a key', () => {
diff --git a/web/src/utils/messagePayloadPreview.ts
b/web/src/utils/messagePayloadPreview.ts
index 69113abf5..6090f062e 100644
--- a/web/src/utils/messagePayloadPreview.ts
+++ b/web/src/utils/messagePayloadPreview.ts
@@ -208,7 +208,7 @@ export const buildMessagePropertiesFromRows = (
'DUPLICATE_PROPERTY_KEY',
'error',
'属性名重复',
- `重复属性会覆盖前面的值:${[...duplicates].sort().join(', ')}`,
+ `重复属性仅保留第一个值:${[...duplicates].sort().join(', ')}`,
'properties',
[...duplicates].sort(),
),