-
Notifications
You must be signed in to change notification settings - Fork 458
feat: context values - implement multi-select dropdown on envs #6239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||
| render() { | ||
| const props = this.props | ||
| const { className, ...props } = this.props |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had an issue in here, className was being applied for the container and also for the Select component, passed as {...props}. Now I am extracting it to apply only for the container, that in my view was the goal in here.
9b83d0f to
de201f4
Compare
de201f4 to
1cd271f
Compare
411d490 to
006eb98
Compare
frontend/web/components/segments/Rule/components/RuleConditionValueInput.tsx
Outdated
Show resolved
Hide resolved
d000946 to
1af4e3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Runtime error with undefined updates.value during split
Potential runtime error when changing to PERCENTAGE_SPLIT operator. If updates.value is undefined (when no prior conditions set it) or null (when hideValue was true), the expression updates.value?.toString().split(':')[0] will fail. The optional chaining updates.value?.toString() returns undefined when updates.value is null/undefined, and then calling .split(':') on undefined throws a TypeError. The code should check if updates.value exists before calling split, or handle the undefined case explicitly.
frontend/web/components/segments/Rule/Rule.tsx#L116-L117
flagsmith/frontend/web/components/segments/Rule/Rule.tsx
Lines 116 to 117 in 1af4e3e
| } | |
| } |
- Fix bug when change from IS_SET or IS_NOT_SET to Modulo, it was breaking the page
1af4e3e to
c050b4c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Guard Clause: Fix Nullo Value Split Failure
When changing operator to PERCENTAGE_SPLIT, if updates.value is null (which happens when changing from a hideValue operator), the expression updates.value?.toString().split(':')[0] will fail. The optional chaining ?. only short-circuits the toString() call, returning undefined, but then .split(':') is called on undefined which will throw a TypeError: "Cannot read property 'split' of undefined". The fix should chain the split call as well: updates.value?.toString()?.split(':')[0] or handle the null case explicitly before this block.
frontend/web/components/segments/Rule/Rule.tsx#L114-L115
flagsmith/frontend/web/components/segments/Rule/Rule.tsx
Lines 114 to 115 in c050b4c
| } else { | |
| updates.value = updates.value?.toString().split(':')[0] |
Contributes to #5835
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature!Changes
Please describe.
How did you test this code?
Please describe.
Note
Adds multi-select for environment names (IN) and single-select (EQUAL/NOT_EQUAL) in segment rules, with cached condition values and minor UI/style tweaks.
RuleConditionValueInputnow usesMultiSelectforINon$.environment.nameandEnvironmentSelectDropdownforEQUAL/NOT_EQUAL; loads environment options viauseGetEnvironmentsQueryand parses arrays withsafeParseArray.useConditionCacheto cache/restore condition values when changing operator/property; integrated intoRule.tsx.useConditionInputTypeand exports viahooks/index.ts; simplifiesuseRuleContext(removes env dropdown logic).RuleConditionRowlayout (grid classes), passespropertyto value input.classNameon container.CreateSegmentRulesTabForm,CreateSegment,CreateSegmentUsersTabContent,AssociatedSegmentOverrides: Layout adjustments (responsive columns,col-4env selects) and spacing tweaks.react-select: Usemin-heightfor control; extensible value container unchanged; segment rule select width set to 100%.Written by Cursor Bugbot for commit 006eb98. This will update automatically on new commits. Configure here.