From 81abc1cc7768e1a1c4c558c67595bee2f0e300b6 Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Thu, 25 Sep 2025 20:12:13 +0530 Subject: [PATCH] :fix: Fix auto update of max regex length when the current value is more than previous one --- .../create/[id]/createBlueprintSteps/ExtractFields.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/create/[id]/createBlueprintSteps/ExtractFields.tsx b/src/app/create/[id]/createBlueprintSteps/ExtractFields.tsx index ed6d4560..8ddac355 100644 --- a/src/app/create/[id]/createBlueprintSteps/ExtractFields.tsx +++ b/src/app/create/[id]/createBlueprintSteps/ExtractFields.tsx @@ -174,8 +174,12 @@ const ExtractFields = ({ if (outputUpdated) { const totalLength = regexOutputs.reduce((acc, cur) => (acc += cur.length), 0); const decomposedRegexes = [...store.decomposedRegexes]; - decomposedRegexes[index].maxLength = totalLength ?? 64; - setField('decomposedRegexes', decomposedRegexes); + const newMaxLength = totalLength ?? 64; + const currentMaxLength = decomposedRegexes[index]?.maxLength ?? 0; + if (currentMaxLength < newMaxLength) { + decomposedRegexes[index].maxLength = newMaxLength; + setField('decomposedRegexes', decomposedRegexes); + } } } catch (error) { console.error('Error testing decomposed regex:', error);