clear flags when changing groups mid-session - #3270
Open
danoswaltCL wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the JS client SDK where changing feature-flag session groups mid-session would continue returning feature flags cached for the previous group set, preventing correct refetching for the new groups.
Changes:
- Clear the in-memory feature flag cache whenever
setFeatureFlagUserGroupsForSession()is called so subsequent flag reads refetch against the updated groups. - Add/expand unit tests to verify cache invalidation behavior and refetching after group changes.
- Add a small DataService API (
clearFeatureFlags) to support explicit cache invalidation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| clientlibs/js/src/UpGradeClient/UpgradeClient.ts | Clears cached feature flags when session groups are updated; ensures getAllFeatureFlags() refetches after group changes. |
| clientlibs/js/src/UpGradeClient/UpgradeClient.spec.ts | Adds tests asserting cache clearing and that the next getAllFeatureFlags() call refetches after group changes. |
| clientlibs/js/src/DataService/DataService.ts | Introduces clearFeatureFlags() to explicitly invalidate the feature flag cache. |
| clientlibs/js/src/DataService/DataService.spec.ts | Adds coverage for clearFeatureFlags() clearing previously cached flags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bcb37
reviewed
Aug 6, 2026
bcb37
left a comment
Collaborator
There was a problem hiding this comment.
- Are we not caching per user/groups? Shouldn't it be the default behavior to refetch flags when user info has changed?
- Do we need to make this change in the Java client lib too?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#3267 this will unblock some work clc is trying to do, the ts client lib has a method for changing the groups that get sent with feature-flags, where a different set of groups could potentially fetch different flags. it had a bug though in that it doesn't clear previously fetched flags, so it always returned the flags for the original set of groups used. this now just clears the previous flags so that we'll successfully refetch.