From a96ecd56bdf55dee834407226d236ebc44e70b3d Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 26 Nov 2024 14:50:51 -0800 Subject: [PATCH 1/4] chore(): add disclaimer for boostrapping feature flags behavior post-init --- contents/docs/feature-flags/snippets/bootstrapping-intro.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contents/docs/feature-flags/snippets/bootstrapping-intro.mdx b/contents/docs/feature-flags/snippets/bootstrapping-intro.mdx index a8cc708a16a5..3a512b7896f2 100644 --- a/contents/docs/feature-flags/snippets/bootstrapping-intro.mdx +++ b/contents/docs/feature-flags/snippets/bootstrapping-intro.mdx @@ -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. \ No newline at end of file +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 is able to fetch feature flags from PostHog, it will use those flag values instead of bootstrapped flag values. \ No newline at end of file From 4f74fd74ad70a73d5d7ef9320c5f7713f59fb6ac Mon Sep 17 00:00:00 2001 From: Haven Barnes Date: Tue, 26 Nov 2024 15:15:07 -0800 Subject: [PATCH 2/4] tweak --- contents/docs/feature-flags/bootstrapping.mdx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/contents/docs/feature-flags/bootstrapping.mdx b/contents/docs/feature-flags/bootstrapping.mdx index 682b0996b108..9058e1f325b8 100644 --- a/contents/docs/feature-flags/bootstrapping.mdx +++ b/contents/docs/feature-flags/bootstrapping.mdx @@ -128,6 +128,26 @@ export function MyApp() { + +## Overriding feature flags + +Bootstrapped feature flag values are temporary and will be disregarded after flag values are fetched from PostHog. +If you are trying to override feature flag values in a persistent manner, some PostHog SDKs support overriding flags: + + + + +```node +posthog.overrideFeatureFlag('my-feature-flag', true) +``` + +```js-web +posthog.feature_flags.override({'my-feature-flag': 'variant-1', 'other-feature': true}) +``` + + + + ## Examples - [How to bootstrap feature flags in React and Express](/tutorials/bootstrap-feature-flags-react) From ce0260f9f8dd91b5ccbae1b85783cd49b554cff4 Mon Sep 17 00:00:00 2001 From: Haven Date: Wed, 27 Nov 2024 13:36:37 -0800 Subject: [PATCH 3/4] Update contents/docs/feature-flags/snippets/bootstrapping-intro.mdx Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> --- contents/docs/feature-flags/snippets/bootstrapping-intro.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contents/docs/feature-flags/snippets/bootstrapping-intro.mdx b/contents/docs/feature-flags/snippets/bootstrapping-intro.mdx index 3a512b7896f2..6b77ceabdb67 100644 --- a/contents/docs/feature-flags/snippets/bootstrapping-intro.mdx +++ b/contents/docs/feature-flags/snippets/bootstrapping-intro.mdx @@ -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. After the SDK is able to fetch feature flags from PostHog, it will use those flag values instead of bootstrapped flag values. \ No newline at end of file +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. \ No newline at end of file From 913fdf1516dc04be4ced059677788d91d5fa0b14 Mon Sep 17 00:00:00 2001 From: Haven Date: Wed, 27 Nov 2024 13:37:14 -0800 Subject: [PATCH 4/4] Update contents/docs/feature-flags/bootstrapping.mdx Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> --- contents/docs/feature-flags/bootstrapping.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contents/docs/feature-flags/bootstrapping.mdx b/contents/docs/feature-flags/bootstrapping.mdx index 9058e1f325b8..1a2f81e6efc7 100644 --- a/contents/docs/feature-flags/bootstrapping.mdx +++ b/contents/docs/feature-flags/bootstrapping.mdx @@ -131,8 +131,7 @@ export function MyApp() { ## Overriding feature flags -Bootstrapped feature flag values are temporary and will be disregarded after flag values are fetched from PostHog. -If you are trying to override feature flag values in a persistent manner, some PostHog SDKs support overriding 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: