From ea7ba8731c8857fe4ec212c2872489834264cd92 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 8 Jan 2026 15:03:13 +0000 Subject: [PATCH] Complete atomic component library with features.json integration - Fix TypeScript errors in ComponentTreeRenderer and features.json schema - Add missing 'sanitize' field to limit parameter - Build succeeds for Next.js and Storybook - Dynamic stories load configuration from features.json Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- src/config/features.json | 1 + src/utils/ComponentTreeRenderer.tsx | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/config/features.json b/src/config/features.json index e5c7c7f..4d1d1d4 100644 --- a/src/config/features.json +++ b/src/config/features.json @@ -2944,6 +2944,7 @@ "type": "integer", "description": "Query result limit", "validation": "^[0-9]+$", + "sanitize": "integer", "min": 1, "max": 10000, "default": 100 diff --git a/src/utils/ComponentTreeRenderer.tsx b/src/utils/ComponentTreeRenderer.tsx index 20cc8fc..f072376 100644 --- a/src/utils/ComponentTreeRenderer.tsx +++ b/src/utils/ComponentTreeRenderer.tsx @@ -236,7 +236,7 @@ function interpolateValue(value: any, data: Record): any { const [, operation, argsStr] = mathOp; const safeOps = ['abs', 'ceil', 'floor', 'round', 'max', 'min']; - if (safeOps.includes(operation)) { + if (operation && argsStr && safeOps.includes(operation)) { try { // Parse arguments safely const args = argsStr.split(',').map(arg => { @@ -258,11 +258,13 @@ function interpolateValue(value: any, data: Record): any { const ternaryMatch = expression.match(/^(.+?)\s*\?\s*(.+?)\s*:\s*(.+)$/); if (ternaryMatch) { const [, condition, trueValue, falseValue] = ternaryMatch; - const conditionResult = evaluateCondition(condition.trim(), data); - const targetValue = conditionResult ? trueValue.trim() : falseValue.trim(); - - // Recursively interpolate the result - return interpolateValue(`{{${targetValue}}}`, data); + if (condition && trueValue !== undefined && falseValue !== undefined) { + const conditionResult = evaluateCondition(condition.trim(), data); + const targetValue = conditionResult ? trueValue.trim() : falseValue.trim(); + + // Recursively interpolate the result + return interpolateValue(`{{${targetValue}}}`, data); + } } // Simple property access