Skip to content
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

Fix undefined featureFlagSegmentInclusion and featureFlagSegmentExclusion errors #1833

Merged
merged 7 commits into from
Aug 20, 2024

Conversation

zackcl
Copy link
Collaborator

@zackcl zackcl commented Aug 19, 2024

Description:

This PR fixes a bug where undefined featureFlagSegmentInclusion and featureFlagSegmentExclusion properties were sometimes causing runtime errors (e.g., TypeError: Cannot read properties of undefined (reading 'some')) in the Feature Flags reducer while deleting or updating an include/exclude list (The error seemed to happen randomly when there are many feature flags and include/exclude lists defined).

Key Changes:

Added optional chaining (?.) to featureFlagSegmentInclusion and featureFlagSegmentExclusion property accesses.
Implemented fallback to empty arrays (?? []) when these properties are undefined.

Bug Fixed:

Resolves "Cannot read properties of undefined" errors occurring when accessing or operating on featureFlagSegmentInclusion or featureFlagSegmentExclusion.

Testing:

  • Verified that the reducer now handles cases with undefined properties without errors.
  • Tested with multiple feature flags and include/exclude lists to ensure stability.

@danoswaltCL
Copy link
Collaborator

Love explanation in the PR of the changes, I assume this was GPT assisted? How did you prompt it?

@zackcl zackcl requested a review from danoswaltCL August 20, 2024 14:16
@danoswaltCL danoswaltCL merged commit 61afd0f into dev Aug 20, 2024
8 checks passed
@danoswaltCL danoswaltCL deleted the bugfix/ff-reducer-undefined branch August 20, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants