Skip to content

Commit 46616c8

Browse files
Merge branch 'master' into onboarding-flow-recipe-blog-post
2 parents 21db5d6 + 86c9f1c commit 46616c8

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

contents/docs/integrate/feature-flags-code/_snippets/feature-flags-code-react-native.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,23 @@ posthog.getFeatureFlag('key-for-your-multivariate-flag')
6060
posthog.getFeatureFlagPayload('key-for-your-multivariate-flag')
6161
```
6262

63+
### Ensuring flags are loaded before usage
64+
65+
Every time a user opens the app, we send a request in the background to fetch the feature flags that apply to that user. We store those flags in the storage.
66+
67+
This means that for most screens, the feature flags are available immediately — **except for the first time a user visits**.
68+
69+
To handle this, you can use the `onFeatureFlags` callback to wait for the feature flag request to finish:
70+
71+
```react-native
72+
posthog.onFeatureFlags((flags) => {
73+
// feature flags are guaranteed to be available at this point
74+
if (posthog.isFeatureEnabled('flag-key')) {
75+
// do something
76+
}
77+
})
78+
```
79+
6380
### Reloading flags
6481

6582
PostHog loads feature flags when instantiated and refreshes whenever methods are called that affect the flag.

src/pages/docs/logs/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const Content = () => {
7676
<h2 className="mb-4 mt-0" id="pricing">
7777
Pricing
7878
</h2>
79-
<p>Logs is currently in early alpha. While in alpha and beta, Logs is free to use.</p>
79+
<p>Logs is currently in beta. While in beta, Logs is free to use.</p>
8080
<p>
8181
After the beta, pricing will be based on GB/ingest. We will offer 30 days standard retention. You'll
8282
get 50GB ingest free each month, with discounts as your usage grows.

0 commit comments

Comments
 (0)