-
Notifications
You must be signed in to change notification settings - Fork 123
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
feat(flags): give users the ability to suppress override warning logs, if desired #1328
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hey @dmarticus! 👋 |
Size Change: +244 B (+0.02%) Total Size: 1.16 MB
ℹ️ View Unchanged
|
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.
Ship it
if (!this.instance.__loaded || !this.instance.persistence) { | ||
return logger.uninitializedWarning('posthog.feature_flags.override') | ||
} | ||
|
||
this._override_warning = false | ||
this._override_warning = suppressWarning |
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.
this _override_warning
is confusing because for a value of false
, we log the debug warning.
posthog-js/src/posthog-featureflags.ts
Lines 115 to 122 in 25713e9
if (!this._override_warning) { | |
logger.warn(' Overriding feature flags!', { | |
enabledFlags, | |
overriddenFlags, | |
finalFlags, | |
}) | |
this._override_warning = true | |
} |
Good fix here.
Changes
We've supported manually overriding feature flag values in the client for years (and our toolbar natively supports it), but since this override doesn't persist to the backend, we've historically always just treated this feature as a debug feature only. However, there's been a influx of support requests (on both Twitter and in our support inbox) that are asking about this feature, and one user explicitly mentioned that the feature would be perfect for his use case if it weren't for the debug warning and logs. I started a discussion about this in Slack, and if we decide that it's safe to give users the ability to remove these logs, this PR enables it.
Checklist