From e515aed960ae9cf97b6546ded791f162a00f4780 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 5 Apr 2026 21:10:00 -0700 Subject: [PATCH] fix: preserve wordcloud config in EChartsOptionBuilder ensureStyle Same bug as chartSlice - the builder's ensureStyle was stripping custom properties like wordcloud. Now preserves all non-standard keys. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/adapters/gateways/EChartsOptionBuilder/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/adapters/gateways/EChartsOptionBuilder/index.ts b/frontend/src/adapters/gateways/EChartsOptionBuilder/index.ts index de65f20..35b6992 100644 --- a/frontend/src/adapters/gateways/EChartsOptionBuilder/index.ts +++ b/frontend/src/adapters/gateways/EChartsOptionBuilder/index.ts @@ -23,8 +23,13 @@ const DEFAULT_STYLE: StyleConfig = { animation: { enabled: true, duration: 500, easing: 'ease-out' }, }; -function ensureStyle(style: any): StyleConfig { +function ensureStyle(style: any): StyleConfig & Record { if (!style || typeof style !== 'object') return DEFAULT_STYLE; + const known = new Set(['title','colors','legend','xAxis','yAxis','dataLabel','background','border','animation']); + const custom: Record = {}; + for (const key of Object.keys(style)) { + if (!known.has(key)) custom[key] = style[key]; + } return { title: { ...DEFAULT_STYLE.title, ...(style.title ?? {}) }, colors: (Array.isArray(style.colors) && style.colors.length > 0) ? style.colors : DEFAULT_STYLE.colors, @@ -35,6 +40,7 @@ function ensureStyle(style: any): StyleConfig { background: { ...DEFAULT_STYLE.background, ...(style.background ?? {}) }, border: { ...DEFAULT_STYLE.border, ...(style.border ?? {}) }, animation: { ...DEFAULT_STYLE.animation, ...(style.animation ?? {}) }, + ...custom, }; }