-
Notifications
You must be signed in to change notification settings - Fork 145
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
chore(flags): Remove feature flag payloads from persistence #1846
base: main
Are you sure you want to change the base?
Conversation
We already store feature flag details in persistence, so we can calculate payloads from that rather than storing both.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
PR Summary
This PR refactors feature flag payload handling in PostHog's JavaScript SDK by removing redundant storage of payloads in local storage, since they can be derived from existing feature flag details.
- Added
createFeatureFlagDetailsFromLegacyDecideResponse
in/src/posthog-featureflags.ts
to handle legacy response formats - Modified
getFlagPayloads()
to calculate payloads from flag details instead of reading from storage - Made
id
field optional inFeatureFlagMetadata
type in/src/types.ts
to support cases where ID isn't available - Updated tests in
/src/__tests__/featureflags.test.ts
to verify payload handling through flag details metadata - Added empty
flags
object todecideResponse
mock in/playwright/utils/setup.ts
for testing
6 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -1838,6 +1936,7 @@ describe('parseFeatureFlagDecideResponse', () => { | |||
payload: 300, |
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.
syntax: Duplicate 'payload' property in metadata object
payload: 300, |
Size Change: +1.79 kB (+0.05%) Total Size: 3.63 MB
ℹ️ View Unchanged
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the |
We already store feature flag details in persistence, so we can calculate payloads from that rather than storing payloads twice. We still store active feature flags as well as calculated flags in persistence and that's probably just fine as the data is a lot less and we use those everywhere.
Changes
This is a refactoring. No behavioral changes other than
$feature_flag_payloads
is no longer stored in local storage.Checklist
Testing
$feature_flag_payloads
no longer is stored in local storage.