diff --git a/bun.lockb b/bun.lockb index bae5bd6..115901e 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/src/app/create/[id]/createBlueprintSteps/ExtractFields.tsx b/src/app/create/[id]/createBlueprintSteps/ExtractFields.tsx index f871be1..fc6f783 100644 --- a/src/app/create/[id]/createBlueprintSteps/ExtractFields.tsx +++ b/src/app/create/[id]/createBlueprintSteps/ExtractFields.tsx @@ -156,11 +156,12 @@ const ExtractFields = ({ return; } - const regexOutputs = await testDecomposedRegex( + const {result: regexOutputs, length: totalLength} = await testDecomposedRegex( body, header, parsedRegex, - revealPrivateFields + revealPrivateFields, + true ); const outputUpdated = @@ -183,10 +184,12 @@ const ExtractFields = ({ // update the max length of the regex at that particular index // Only update when the output changes, so we can still set maxLength if (outputUpdated) { - const totalLength = regexOutputs.reduce((acc, cur) => (acc += cur.length), 0); const decomposedRegexes = [...store.decomposedRegexes]; decomposedRegexes[index].maxLength = totalLength ?? 64; - setField('decomposedRegexes', decomposedRegexes); + if (decomposedRegexes[index].maxLength < totalLength) { + decomposedRegexes[index].maxLength = totalLength; + setField('decomposedRegexes', decomposedRegexes); + } } } catch (error) { console.error('Error testing decomposed regex:', error);