Skip to content

:fix: Handle error when no public field is present in the regex#239

Open
wryonik wants to merge 15 commits into
mainfrom
shubham/reg-563-fe-ux-fix-error-message-when-there-is-no-public-output-for-a
Open

:fix: Handle error when no public field is present in the regex#239
wryonik wants to merge 15 commits into
mainfrom
shubham/reg-563-fe-ux-fix-error-message-when-there-is-no-public-output-for-a

Conversation

@wryonik
Copy link
Copy Markdown
Collaborator

@wryonik wryonik commented Sep 25, 2025

Note

Require at least one public regex part to show outputs; otherwise display an error prompting the user to add a public regex.

  • UI (ExtractFields):
    • Gate output rendering on presence of at least one public part in regex.parts.
      • If a public part exists and outputs are valid, show the formatted output with existing error styling.
      • If no public part exists, display a red error box prompting: "Please add at least one public regex".

Written by Cursor Bugbot for commit 302e782. This will update automatically on new commits. Configure here.

@Divide-By-0
Copy link
Copy Markdown
Member

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

regexGeneratedOutputs[index] !== undefined &&
regexGeneratedOutputs[index] !== null &&
regexGeneratedOutputs[index].length > 0 ? (
{regex.parts.some((p: any) => p.isPublic) ? (
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Regex Parts Parsing Error

The condition checking for public regex parts directly calls .some() on regex.parts. This can lead to a runtime error when regex.parts is a string (JSON) instead of an array, as strings lack a .some() method. The parseRegexParts() helper is designed to handle both formats.

Fix in Cursor Fix in Web

parseRegexParts(regex.parts).length > 0 &&
regexGeneratedOutputs[index] !== undefined &&
regexGeneratedOutputs[index] !== null &&
regexGeneratedOutputs[index].length > 0 ? (
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make the goal of these conditions more clear? maybe store them in a variable with a descriptive name so that in the future if we need to modify this it's easier to understand what is this doing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants