From 3bb6dc85c0f997d37f92ae768d5f4ad98015edc7 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 5 Apr 2026 20:13:00 -0700 Subject: [PATCH] fix: preserve custom style extensions (wordcloud config) in ensureStyle ensureStyle() was stripping unknown properties like 'wordcloud'. Now collects and preserves all non-standard style keys so chart-type specific configs survive Redux state updates. Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/adapters/state/redux/chartSlice.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/adapters/state/redux/chartSlice.ts b/frontend/src/adapters/state/redux/chartSlice.ts index 7579952..9e0f1c6 100644 --- a/frontend/src/adapters/state/redux/chartSlice.ts +++ b/frontend/src/adapters/state/redux/chartSlice.ts @@ -16,8 +16,14 @@ 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 }; + // Collect any custom/extension properties (like wordcloud) + 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, @@ -28,6 +34,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, // Preserve wordcloud and any other custom extensions }; }