Skip to content

fix(Utils): add guard against null rule value in validateRule#7779

Open
afsuyadi wants to merge 1 commit into
Flagsmith:mainfrom
afsuyadi:fix-error-create-segment
Open

fix(Utils): add guard against null rule value in validateRule#7779
afsuyadi wants to merge 1 commit into
Flagsmith:mainfrom
afsuyadi:fix-error-create-segment

Conversation

@afsuyadi

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • [✔] I have read the Contributing Guide.
  • [✔] I have added information to docs/ if required so people know about the feature.
  • [✔] I have filled in the "Changes" section below.
  • [✔] I have filled in the "How did you test this code" section below.

Changes

Contributes to #7536

  1. Error happens when CreateSegment component is trying to call method validateRule() by passing an object.
  2. The method crashes when split() method is executed on a variable that isn't string-type.
  3. Inside method validateRule(), only value prop that is accessed and doesn't have its own guard, so the method crashes when it's empty (either null or undefined).
  4. I add loose equality guard, to catch only null and undefined value.

How did you test this code?

  1. I try to simulate this on my local by manually creating the Segment via UI, but it seems no error happens, because the button Create Segment itself is already been greyed out.
  2. I deduce that this error happens via API backend hit.
Screencast.from.14-06-26.11.46.58.webm

@afsuyadi afsuyadi requested a review from a team as a code owner June 14, 2026 05:09
@afsuyadi afsuyadi requested review from kyle-ssg and removed request for a team June 14, 2026 05:09
@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

@afsuyadi is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants