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 segment errors in Feature Flag Inclusion and Exclusion selectors #1911

Merged
merged 2 commits into from
Sep 10, 2024

Conversation

zackcl
Copy link
Collaborator

@zackcl zackcl commented Sep 9, 2024

Resolves #1910

This PR fixes the TypeError: Cannot read properties of undefined (reading 'createdAt') error that occurs when navigating to some Feature Flag details pages. This error is caused by attempting to access the createdAt property from segment when segment is not available from the store (This issue started happening after merging #1907 which included featureFlagSegmentInclusion in the flags/paginated response). The fix involves adding a filter step: .filter((inclusion) => inclusion.segment) to ensure segment exists before accessing its properties. This PR also simplifies the existing selector code.

Copy link
Collaborator

@bcb37 bcb37 left a comment

Choose a reason for hiding this comment

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

This works, but I can't reproduce the error on dev now.

@zackcl zackcl merged commit 392a053 into dev Sep 10, 2024
14 checks passed
@zackcl zackcl deleted the bugfix/1910-undefined-segment branch September 10, 2024 08:01
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.

TypeError: Cannot read properties of undefined (reading 'createdAt') when navigating to some FF details page
3 participants