Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
11 changes: 7 additions & 4 deletions src/app/create/[id]/createBlueprintSteps/ExtractFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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);
Expand Down