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

chore(): add disclaimer for boostrapping feature flags behavior post-init #9988

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions contents/docs/feature-flags/bootstrapping.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,25 @@ export function MyApp() {

</MultiLanguage>


## Overriding feature flags

Bootstrapped feature flag values are temporary and are disregarded after PostHog fetches flag values. If you are trying to override feature flag values in a persistent manner, some PostHog SDKs support overriding flags:


<MultiLanguage selector="tabs">

```node
posthog.overrideFeatureFlag('my-feature-flag', true)
```

```js-web
posthog.feature_flags.override({'my-feature-flag': 'variant-1', 'other-feature': true})
```

</MultiLanguage>


## Examples

- [How to bootstrap feature flags in React and Express](/tutorials/bootstrap-feature-flags-react)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Since there is a delay between initializing PostHog and fetching feature flags, feature flags are not always available immediately. This makes them unusable if you want to do something like redirecting a user to a different page based on a feature flag.

To have your feature flags available immediately, you can initialize PostHog with precomputed values until it has had a chance to fetch them. This is called bootstrapping.
To have your feature flags available immediately, you can initialize PostHog with precomputed values until it has had a chance to fetch them. This is called bootstrapping. After the SDK fetches feature flags from PostHog, it will use those flag values instead of bootstrapped ones.