Skip to content

feat: add disableFeatureFlagReload option to identify()#3295

Closed
dmarticus wants to merge 1 commit intomainfrom
dmarticus/identify-skip-flag-reload
Closed

feat: add disableFeatureFlagReload option to identify()#3295
dmarticus wants to merge 1 commit intomainfrom
dmarticus/identify-skip-flag-reload

Conversation

@dmarticus
Copy link
Copy Markdown
Contributor

Summary

  • Adds a disableFeatureFlagReload option to identify() across browser, core, and React Native SDKs
  • When identify() changes the distinct_id, the SDK unconditionally reloads feature flags. The /flags request fires before the person merge triggered by $identify has propagated server-side, which can cause the server to re-bucket the user under a different variant. This option lets callers suppress the automatic reload and let flags refresh on the next session when identities are fully merged.
  • New IdentifyOptions type in @posthog/types and PostHogIdentifyOptions in the core package

Usage

// Browser SDK
posthog.identify('authenticated-user-id', userProperties, undefined, {
  disableFeatureFlagReload: true,
})

// React Native SDK
posthog.identify('authenticated-user-id', userProperties, {
  disableFeatureFlagReload: true,
})

Test plan

  • Added browser SDK tests for disableFeatureFlagReload: true and false
  • Added core SDK tests verifying no /flags request when option is set
  • All existing identify tests continue to pass
  • React Native tests pass (inherits core behavior via super.identify())
  • TypeScript compiles cleanly across all three packages

When identify() changes the distinct_id, the SDK automatically reloads
feature flags. However, the /flags request fires before the person merge
triggered by $identify has propagated server-side, causing the server to
re-bucket the user under a different variant.

This adds a disableFeatureFlagReload option to identify() across the
browser, core, and React Native SDKs, allowing callers to suppress the
automatic flag reload and let flags refresh on the next session when
identities are fully merged.
@dmarticus dmarticus requested a review from a team as a code owner March 28, 2026 19:24
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
posthog-example-next-app-router Ready Ready Preview Mar 28, 2026 7:32pm
posthog-js Ready Ready Preview Mar 28, 2026 7:32pm
posthog-nextjs-config Ready Ready Preview Mar 28, 2026 7:32pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

📝 No Changeset Found

This PR doesn't include a changeset. A changeset (and the release label) is required to release a new version.

How to add a changeset

Run this command and follow the prompts:

pnpm changeset

Remember: Never use major version bumps for posthog-js as it's autoloaded by clients.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 28, 2026

Comments Outside Diff (1)

  1. packages/browser/src/posthog-core.ts, line 2334-2343 (link)

    P2 Missing changeset file for this new feature

    This PR adds a new public API (disableFeatureFlagReload option) to packages/browser (the posthog-js package), packages/core, and packages/react-native. No .changeset/*.md file was included. A minor changeset entry is expected for each affected package, with the browser entry using the package name posthog-js.

    Example .changeset/some-descriptive-name.md:

    ---
    'posthog-js': minor
    'posthog-core': minor
    'posthog-react-native': minor
    ---
    
    Add `disableFeatureFlagReload` option to `identify()` to suppress the automatic feature flag reload when person identity changes.

    Rule Used: In the posthog/posthog-js repository, /packages/br... (source)

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: packages/browser/src/posthog-core.ts
    Line: 2334-2343
    
    Comment:
    **Missing changeset file for this new feature**
    
    This PR adds a new public API (`disableFeatureFlagReload` option) to `packages/browser` (the `posthog-js` package), `packages/core`, and `packages/react-native`. No `.changeset/*.md` file was included. A `minor` changeset entry is expected for each affected package, with the browser entry using the package name `posthog-js`.
    
    Example `.changeset/some-descriptive-name.md`:
    ```markdown
    ---
    'posthog-js': minor
    'posthog-core': minor
    'posthog-react-native': minor
    ---
    
    Add `disableFeatureFlagReload` option to `identify()` to suppress the automatic feature flag reload when person identity changes.
    ```
    
    **Rule Used:** In the posthog/posthog-js repository, /packages/br... ([source](https://app.greptile.com/review/custom-context?memory=1e5ca16f-9836-4241-953d-21bcf9017456))
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: packages/browser/src/posthog-core.ts
Line: 2338

Comment:
**Use `IdentifyOptions` instead of inline type**

The inline type `{ disableFeatureFlagReload?: boolean }` duplicates the `IdentifyOptions` interface already defined in `@posthog/types` and re-exported from `packages/browser/src/types.ts`. Using the named type keeps the implementation consistent with the interface declared in `packages/types/src/posthog.ts` and avoids having to update two places if `IdentifyOptions` gains new fields.

```suggestion
        options?: IdentifyOptions
```

You'll also need to import `IdentifyOptions` at the top of this file (it's already re-exported from `./types`).

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: packages/browser/src/posthog-core.ts
Line: 2437-2439

Comment:
**Add inline comment explaining the suppressed reload**

This is a significant behavior change — suppressing the `/flags` network request on identity change. An inline comment should explain why a caller might want to disable the reload here.

```suggestion
            // When disableFeatureFlagReload is true, skip the early /flags
            // reload to avoid re-bucketing the user before the $identify
            // person-merge has propagated server-side.
            if (!options?.disableFeatureFlagReload) {
                this.reloadFeatureFlags()
            }
```

**Rule Used:** Add inline comments to clarify the purpose of sign... ([source](https://app.greptile.com/review/custom-context?memory=4d5b48c5-045d-4693-9cd9-4081bb19508b))

**Learnt From**
[PostHog/posthog#32083](https://github.com/PostHog/posthog/pull/32083)

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: packages/core/src/posthog-core.ts
Line: 336-338

Comment:
**Add inline comment explaining the suppressed reload**

Same pattern as the browser implementation — the conditional reload lacks an explanatory comment, making it harder for future readers to understand the intent without consulting the PR description.

```suggestion
        // When disableFeatureFlagReload is true, skip the early /flags
        // reload to avoid re-bucketing the user before the $identify
        // person-merge has propagated server-side.
        if (!options?.disableFeatureFlagReload) {
          this.reloadFeatureFlags()
        }
```

**Rule Used:** Add inline comments to clarify the purpose of sign... ([source](https://app.greptile.com/review/custom-context?memory=4d5b48c5-045d-4693-9cd9-4081bb19508b))

**Learnt From**
[PostHog/posthog#32083](https://github.com/PostHog/posthog/pull/32083)

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: packages/browser/src/posthog-core.ts
Line: 2334-2343

Comment:
**Missing changeset file for this new feature**

This PR adds a new public API (`disableFeatureFlagReload` option) to `packages/browser` (the `posthog-js` package), `packages/core`, and `packages/react-native`. No `.changeset/*.md` file was included. A `minor` changeset entry is expected for each affected package, with the browser entry using the package name `posthog-js`.

Example `.changeset/some-descriptive-name.md`:
```markdown
---
'posthog-js': minor
'posthog-core': minor
'posthog-react-native': minor
---

Add `disableFeatureFlagReload` option to `identify()` to suppress the automatic feature flag reload when person identity changes.
```

**Rule Used:** In the posthog/posthog-js repository, /packages/br... ([source](https://app.greptile.com/review/custom-context?memory=1e5ca16f-9836-4241-953d-21bcf9017456))

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "feat: add disableFeatureFlagReload optio..." | Re-trigger Greptile

new_distinct_id?: string,
userPropertiesToSet?: Properties,
userPropertiesToSetOnce?: Properties,
options?: { disableFeatureFlagReload?: boolean }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Use IdentifyOptions instead of inline type

The inline type { disableFeatureFlagReload?: boolean } duplicates the IdentifyOptions interface already defined in @posthog/types and re-exported from packages/browser/src/types.ts. Using the named type keeps the implementation consistent with the interface declared in packages/types/src/posthog.ts and avoids having to update two places if IdentifyOptions gains new fields.

Suggested change
options?: { disableFeatureFlagReload?: boolean }
options?: IdentifyOptions

You'll also need to import IdentifyOptions at the top of this file (it's already re-exported from ./types).

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/browser/src/posthog-core.ts
Line: 2338

Comment:
**Use `IdentifyOptions` instead of inline type**

The inline type `{ disableFeatureFlagReload?: boolean }` duplicates the `IdentifyOptions` interface already defined in `@posthog/types` and re-exported from `packages/browser/src/types.ts`. Using the named type keeps the implementation consistent with the interface declared in `packages/types/src/posthog.ts` and avoids having to update two places if `IdentifyOptions` gains new fields.

```suggestion
        options?: IdentifyOptions
```

You'll also need to import `IdentifyOptions` at the top of this file (it's already re-exported from `./types`).

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +2437 to +2439
if (!options?.disableFeatureFlagReload) {
this.reloadFeatureFlags()
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Add inline comment explaining the suppressed reload

This is a significant behavior change — suppressing the /flags network request on identity change. An inline comment should explain why a caller might want to disable the reload here.

Suggested change
if (!options?.disableFeatureFlagReload) {
this.reloadFeatureFlags()
}
// When disableFeatureFlagReload is true, skip the early /flags
// reload to avoid re-bucketing the user before the $identify
// person-merge has propagated server-side.
if (!options?.disableFeatureFlagReload) {
this.reloadFeatureFlags()
}

Rule Used: Add inline comments to clarify the purpose of sign... (source)

Learnt From
PostHog/posthog#32083

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/browser/src/posthog-core.ts
Line: 2437-2439

Comment:
**Add inline comment explaining the suppressed reload**

This is a significant behavior change — suppressing the `/flags` network request on identity change. An inline comment should explain why a caller might want to disable the reload here.

```suggestion
            // When disableFeatureFlagReload is true, skip the early /flags
            // reload to avoid re-bucketing the user before the $identify
            // person-merge has propagated server-side.
            if (!options?.disableFeatureFlagReload) {
                this.reloadFeatureFlags()
            }
```

**Rule Used:** Add inline comments to clarify the purpose of sign... ([source](https://app.greptile.com/review/custom-context?memory=4d5b48c5-045d-4693-9cd9-4081bb19508b))

**Learnt From**
[PostHog/posthog#32083](https://github.com/PostHog/posthog/pull/32083)

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +336 to +338
if (!options?.disableFeatureFlagReload) {
this.reloadFeatureFlags()
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Add inline comment explaining the suppressed reload

Same pattern as the browser implementation — the conditional reload lacks an explanatory comment, making it harder for future readers to understand the intent without consulting the PR description.

Suggested change
if (!options?.disableFeatureFlagReload) {
this.reloadFeatureFlags()
}
// When disableFeatureFlagReload is true, skip the early /flags
// reload to avoid re-bucketing the user before the $identify
// person-merge has propagated server-side.
if (!options?.disableFeatureFlagReload) {
this.reloadFeatureFlags()
}

Rule Used: Add inline comments to clarify the purpose of sign... (source)

Learnt From
PostHog/posthog#32083

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/core/src/posthog-core.ts
Line: 336-338

Comment:
**Add inline comment explaining the suppressed reload**

Same pattern as the browser implementation — the conditional reload lacks an explanatory comment, making it harder for future readers to understand the intent without consulting the PR description.

```suggestion
        // When disableFeatureFlagReload is true, skip the early /flags
        // reload to avoid re-bucketing the user before the $identify
        // person-merge has propagated server-side.
        if (!options?.disableFeatureFlagReload) {
          this.reloadFeatureFlags()
        }
```

**Rule Used:** Add inline comments to clarify the purpose of sign... ([source](https://app.greptile.com/review/custom-context?memory=4d5b48c5-045d-4693-9cd9-4081bb19508b))

**Learnt From**
[PostHog/posthog#32083](https://github.com/PostHog/posthog/pull/32083)

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

Size Change: +587 B (+0.01%)

Total Size: 6.58 MB

Filename Size Change
packages/browser/dist/array.full.es5.js 326 kB +39 B (+0.01%)
packages/browser/dist/array.full.js 421 kB +39 B (+0.01%)
packages/browser/dist/array.full.no-external.js 442 kB +39 B (+0.01%)
packages/browser/dist/array.js 177 kB +39 B (+0.02%)
packages/browser/dist/array.no-external.js 193 kB +39 B (+0.02%)
packages/browser/dist/default-extensions.js 175 kB +39 B (+0.02%)
packages/browser/dist/main.js 181 kB +39 B (+0.02%)
packages/browser/dist/module.full.js 424 kB +39 B (+0.01%)
packages/browser/dist/module.full.no-external.js 445 kB +39 B (+0.01%)
packages/browser/dist/module.js 181 kB +39 B (+0.02%)
packages/browser/dist/module.no-external.js 197 kB +39 B (+0.02%)
packages/browser/dist/module.slim.js 95 kB +39 B (+0.04%)
packages/browser/dist/module.slim.no-external.js 100 kB +39 B (+0.04%)
packages/core/dist/posthog-core.js 41.1 kB +40 B (+0.1%)
packages/core/dist/posthog-core.mjs 36.2 kB +40 B (+0.11%)
ℹ️ View Unchanged
Filename Size Change
packages/ai/dist/anthropic/index.cjs 20 kB 0 B
packages/ai/dist/anthropic/index.mjs 19.7 kB 0 B
packages/ai/dist/gemini/index.cjs 26.9 kB 0 B
packages/ai/dist/gemini/index.mjs 26.8 kB 0 B
packages/ai/dist/index.cjs 161 kB 0 B
packages/ai/dist/index.mjs 160 kB 0 B
packages/ai/dist/langchain/index.cjs 42.7 kB 0 B
packages/ai/dist/langchain/index.mjs 42.1 kB 0 B
packages/ai/dist/openai/index.cjs 46.7 kB 0 B
packages/ai/dist/openai/index.mjs 46.4 kB 0 B
packages/ai/dist/otel/index.cjs 1.14 kB 0 B
packages/ai/dist/otel/index.mjs 1.08 kB 0 B
packages/ai/dist/vercel/index.cjs 35.4 kB 0 B
packages/ai/dist/vercel/index.mjs 35.3 kB 0 B
packages/browser/dist/all-external-dependencies.js 266 kB 0 B
packages/browser/dist/conversations.js 63.8 kB 0 B
packages/browser/dist/crisp-chat-integration.js 1.88 kB 0 B
packages/browser/dist/customizations.full.js 17.8 kB 0 B
packages/browser/dist/dead-clicks-autocapture.js 13 kB 0 B
packages/browser/dist/element-inference.js 5.59 kB 0 B
packages/browser/dist/exception-autocapture.js 11.7 kB 0 B
packages/browser/dist/extension-bundles.js 97.9 kB 0 B
packages/browser/dist/external-scripts-loader.js 2.83 kB 0 B
packages/browser/dist/intercom-integration.js 1.93 kB 0 B
packages/browser/dist/lazy-recorder.js 151 kB 0 B
packages/browser/dist/logs.js 38.3 kB 0 B
packages/browser/dist/posthog-recorder.js 251 kB 0 B
packages/browser/dist/product-tours-preview.js 76.2 kB 0 B
packages/browser/dist/product-tours.js 115 kB 0 B
packages/browser/dist/recorder-v2.js 111 kB 0 B
packages/browser/dist/recorder.js 111 kB 0 B
packages/browser/dist/surveys-preview.js 75.3 kB 0 B
packages/browser/dist/surveys.js 89.8 kB 0 B
packages/browser/dist/tracing-headers.js 1.74 kB 0 B
packages/browser/dist/web-vitals-with-attribution.js 11.8 kB 0 B
packages/browser/dist/web-vitals.js 6.39 kB 0 B
packages/browser/react/dist/esm/index.js 20.7 kB 0 B
packages/browser/react/dist/esm/surveys/index.js 4.54 kB 0 B
packages/browser/react/dist/umd/index.js 24 kB 0 B
packages/browser/react/dist/umd/surveys/index.js 5.49 kB 0 B
packages/convex/dist/client/index.js 7.66 kB 0 B
packages/convex/dist/component/_generated/api.js 712 B 0 B
packages/convex/dist/component/_generated/component.js 212 B 0 B
packages/convex/dist/component/_generated/dataModel.js 230 B 0 B
packages/convex/dist/component/_generated/server.js 3.71 kB 0 B
packages/convex/dist/component/convex.config.js 133 B 0 B
packages/convex/dist/component/lib.js 7.95 kB 0 B
packages/convex/dist/component/schema.js 113 B 0 B
packages/core/dist/error-tracking/chunk-ids.js 2.54 kB 0 B
packages/core/dist/error-tracking/chunk-ids.mjs 1.31 kB 0 B
packages/core/dist/error-tracking/coercers/dom-exception-coercer.js 2.3 kB 0 B
packages/core/dist/error-tracking/coercers/dom-exception-coercer.mjs 993 B 0 B
packages/core/dist/error-tracking/coercers/error-coercer.js 2.02 kB 0 B
packages/core/dist/error-tracking/coercers/error-coercer.mjs 794 B 0 B
packages/core/dist/error-tracking/coercers/error-event-coercer.js 1.76 kB 0 B
packages/core/dist/error-tracking/coercers/error-event-coercer.mjs 513 B 0 B
packages/core/dist/error-tracking/coercers/event-coercer.js 1.82 kB 0 B
packages/core/dist/error-tracking/coercers/event-coercer.mjs 548 B 0 B
packages/core/dist/error-tracking/coercers/index.js 6.79 kB 0 B
packages/core/dist/error-tracking/coercers/index.mjs 326 B 0 B
packages/core/dist/error-tracking/coercers/object-coercer.js 3.46 kB 0 B
packages/core/dist/error-tracking/coercers/object-coercer.mjs 2.07 kB 0 B
packages/core/dist/error-tracking/coercers/primitive-coercer.js 1.67 kB 0 B
packages/core/dist/error-tracking/coercers/primitive-coercer.mjs 419 B 0 B
packages/core/dist/error-tracking/coercers/promise-rejection-event.js 2.59 kB 0 B
packages/core/dist/error-tracking/coercers/promise-rejection-event.mjs 1.25 kB 0 B
packages/core/dist/error-tracking/coercers/string-coercer.js 2.01 kB 0 B
packages/core/dist/error-tracking/coercers/string-coercer.mjs 820 B 0 B
packages/core/dist/error-tracking/coercers/utils.js 2.06 kB 0 B
packages/core/dist/error-tracking/coercers/utils.mjs 716 B 0 B
packages/core/dist/error-tracking/error-properties-builder.js 5.56 kB 0 B
packages/core/dist/error-tracking/error-properties-builder.mjs 4.23 kB 0 B
packages/core/dist/error-tracking/index.js 4.11 kB 0 B
packages/core/dist/error-tracking/index.mjs 152 B 0 B
packages/core/dist/error-tracking/parsers/base.js 1.83 kB 0 B
packages/core/dist/error-tracking/parsers/base.mjs 464 B 0 B
packages/core/dist/error-tracking/parsers/chrome.js 2.73 kB 0 B
packages/core/dist/error-tracking/parsers/chrome.mjs 1.32 kB 0 B
packages/core/dist/error-tracking/parsers/gecko.js 2.47 kB 0 B
packages/core/dist/error-tracking/parsers/gecko.mjs 1.13 kB 0 B
packages/core/dist/error-tracking/parsers/index.js 4.75 kB 0 B
packages/core/dist/error-tracking/parsers/index.mjs 2.1 kB 0 B
packages/core/dist/error-tracking/parsers/node.js 3.94 kB 0 B
packages/core/dist/error-tracking/parsers/node.mjs 2.68 kB 0 B
packages/core/dist/error-tracking/parsers/opera.js 2.26 kB 0 B
packages/core/dist/error-tracking/parsers/opera.mjs 746 B 0 B
packages/core/dist/error-tracking/parsers/safari.js 1.88 kB 0 B
packages/core/dist/error-tracking/parsers/safari.mjs 574 B 0 B
packages/core/dist/error-tracking/parsers/winjs.js 1.72 kB 0 B
packages/core/dist/error-tracking/parsers/winjs.mjs 426 B 0 B
packages/core/dist/error-tracking/types.js 1.33 kB 0 B
packages/core/dist/error-tracking/types.mjs 131 B 0 B
packages/core/dist/error-tracking/utils.js 1.8 kB 0 B
packages/core/dist/error-tracking/utils.mjs 604 B 0 B
packages/core/dist/eventemitter.js 1.78 kB 0 B
packages/core/dist/eventemitter.mjs 571 B 0 B
packages/core/dist/featureFlagUtils.js 6.8 kB 0 B
packages/core/dist/featureFlagUtils.mjs 4.32 kB 0 B
packages/core/dist/gzip.js 1.88 kB 0 B
packages/core/dist/gzip.mjs 577 B 0 B
packages/core/dist/index.js 7.28 kB 0 B
packages/core/dist/index.mjs 707 B 0 B
packages/core/dist/posthog-core-stateless.js 31.3 kB 0 B
packages/core/dist/posthog-core-stateless.mjs 28.8 kB 0 B
packages/core/dist/process/cli.js 3.01 kB 0 B
packages/core/dist/process/cli.mjs 1.51 kB 0 B
packages/core/dist/process/config.js 2.65 kB 0 B
packages/core/dist/process/config.mjs 1.41 kB 0 B
packages/core/dist/process/index.js 4.01 kB 0 B
packages/core/dist/process/index.mjs 171 B 0 B
packages/core/dist/process/spawn-local.js 2.17 kB 0 B
packages/core/dist/process/spawn-local.mjs 918 B 0 B
packages/core/dist/process/utils.js 3.27 kB 0 B
packages/core/dist/process/utils.mjs 1.3 kB 0 B
packages/core/dist/surveys/validation.js 3.06 kB 0 B
packages/core/dist/surveys/validation.mjs 1.51 kB 0 B
packages/core/dist/testing/index.js 2.93 kB 0 B
packages/core/dist/testing/index.mjs 79 B 0 B
packages/core/dist/testing/PostHogCoreTestClient.js 3.15 kB 0 B
packages/core/dist/testing/PostHogCoreTestClient.mjs 1.74 kB 0 B
packages/core/dist/testing/test-utils.js 2.77 kB 0 B
packages/core/dist/testing/test-utils.mjs 1.09 kB 0 B
packages/core/dist/types.js 9.5 kB 0 B
packages/core/dist/types.mjs 6.95 kB 0 B
packages/core/dist/utils/bot-detection.js 3.28 kB 0 B
packages/core/dist/utils/bot-detection.mjs 1.95 kB 0 B
packages/core/dist/utils/bucketed-rate-limiter.js 3 kB 0 B
packages/core/dist/utils/bucketed-rate-limiter.mjs 1.62 kB 0 B
packages/core/dist/utils/index.js 11.9 kB 0 B
packages/core/dist/utils/index.mjs 1.98 kB 0 B
packages/core/dist/utils/logger.js 2.5 kB 0 B
packages/core/dist/utils/logger.mjs 1.22 kB 0 B
packages/core/dist/utils/number-utils.js 3.32 kB 0 B
packages/core/dist/utils/number-utils.mjs 1.68 kB 0 B
packages/core/dist/utils/promise-queue.js 2 kB 0 B
packages/core/dist/utils/promise-queue.mjs 768 B 0 B
packages/core/dist/utils/string-utils.js 2.73 kB 0 B
packages/core/dist/utils/string-utils.mjs 1.09 kB 0 B
packages/core/dist/utils/type-utils.js 7.03 kB 0 B
packages/core/dist/utils/type-utils.mjs 3.1 kB 0 B
packages/core/dist/utils/user-agent-utils.js 15.2 kB 0 B
packages/core/dist/utils/user-agent-utils.mjs 12.2 kB 0 B
packages/core/dist/vendor/uuidv7.js 8.29 kB 0 B
packages/core/dist/vendor/uuidv7.mjs 6.72 kB 0 B
packages/next/dist/app/PostHogProvider.js 3.23 kB 0 B
packages/next/dist/client/ClientPostHogProvider.js 1.77 kB 0 B
packages/next/dist/client/hooks.js 174 B 0 B
packages/next/dist/client/PostHogPageView.js 1.7 kB 0 B
packages/next/dist/index.client.js 392 B 0 B
packages/next/dist/index.edge.js 435 B 0 B
packages/next/dist/index.js 426 B 0 B
packages/next/dist/index.react-server.js 411 B 0 B
packages/next/dist/middleware/postHogMiddleware.js 3.62 kB 0 B
packages/next/dist/pages.js 396 B 0 B
packages/next/dist/pages/getServerSidePostHog.js 1.91 kB 0 B
packages/next/dist/pages/PostHogPageView.js 1.2 kB 0 B
packages/next/dist/pages/PostHogProvider.js 1.5 kB 0 B
packages/next/dist/server/getPostHog.js 2.65 kB 0 B
packages/next/dist/server/nodeClientCache.js 1.31 kB 0 B
packages/next/dist/shared/config.js 1.56 kB 0 B
packages/next/dist/shared/constants.js 278 B 0 B
packages/next/dist/shared/cookie.js 4.49 kB 0 B
packages/next/dist/shared/identity.js 264 B 0 B
packages/nextjs-config/dist/config.js 4.97 kB 0 B
packages/nextjs-config/dist/config.mjs 3.49 kB 0 B
packages/nextjs-config/dist/index.js 2.24 kB 0 B
packages/nextjs-config/dist/index.mjs 30 B 0 B
packages/nextjs-config/dist/utils.js 2.93 kB 0 B
packages/nextjs-config/dist/utils.mjs 826 B 0 B
packages/node/dist/client.js 35.9 kB 0 B
packages/node/dist/client.mjs 33.8 kB 0 B
packages/node/dist/entrypoints/index.edge.js 4.25 kB 0 B
packages/node/dist/entrypoints/index.edge.mjs 723 B 0 B
packages/node/dist/entrypoints/index.node.js 5.55 kB 0 B
packages/node/dist/entrypoints/index.node.mjs 1.08 kB 0 B
packages/node/dist/entrypoints/nestjs.js 2.31 kB 0 B
packages/node/dist/entrypoints/nestjs.mjs 42 B 0 B
packages/node/dist/experimental.js 603 B 0 B
packages/node/dist/experimental.mjs 0 B 0 B 🆕
packages/node/dist/exports.js 4.22 kB 0 B
packages/node/dist/exports.mjs 203 B 0 B
packages/node/dist/extensions/context/context.js 2.13 kB 0 B
packages/node/dist/extensions/context/context.mjs 863 B 0 B
packages/node/dist/extensions/context/types.js 603 B 0 B
packages/node/dist/extensions/context/types.mjs 0 B 0 B 🆕
packages/node/dist/extensions/error-tracking/autocapture.js 2.66 kB 0 B
packages/node/dist/extensions/error-tracking/autocapture.mjs 1.24 kB 0 B
packages/node/dist/extensions/error-tracking/index.js 4.14 kB 0 B
packages/node/dist/extensions/error-tracking/index.mjs 2.87 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/context-lines.node.js 8.81 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs 7.15 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/module.node.js 2.78 kB 0 B
packages/node/dist/extensions/error-tracking/modifiers/module.node.mjs 1.45 kB 0 B
packages/node/dist/extensions/express.js 2.84 kB 0 B
packages/node/dist/extensions/express.mjs 1.25 kB 0 B
packages/node/dist/extensions/feature-flags/cache.js 603 B 0 B
packages/node/dist/extensions/feature-flags/cache.mjs 0 B 0 B 🆕
packages/node/dist/extensions/feature-flags/crypto.js 1.57 kB 0 B
packages/node/dist/extensions/feature-flags/crypto.mjs 395 B 0 B
packages/node/dist/extensions/feature-flags/feature-flags.js 38.8 kB 0 B
packages/node/dist/extensions/feature-flags/feature-flags.mjs 36.7 kB 0 B
packages/node/dist/extensions/nestjs.js 4.39 kB 0 B
packages/node/dist/extensions/nestjs.mjs 2.65 kB 0 B
packages/node/dist/extensions/sentry-integration.js 4.66 kB 0 B
packages/node/dist/extensions/sentry-integration.mjs 3.17 kB 0 B
packages/node/dist/storage-memory.js 1.52 kB 0 B
packages/node/dist/storage-memory.mjs 297 B 0 B
packages/node/dist/types.js 1.43 kB 0 B
packages/node/dist/types.mjs 224 B 0 B
packages/node/dist/version.js 1.21 kB 0 B
packages/node/dist/version.mjs 46 B 0 B
packages/nuxt/dist/module.mjs 4.59 kB 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagEnabled.js 566 B 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagPayload.js 690 B 0 B
packages/nuxt/dist/runtime/composables/useFeatureFlagVariantKey.js 591 B 0 B
packages/nuxt/dist/runtime/composables/usePostHog.js 128 B 0 B
packages/nuxt/dist/runtime/nitro-plugin.js 1.08 kB 0 B
packages/nuxt/dist/runtime/vue-plugin.js 1.14 kB 0 B
packages/react-native/dist/autocapture.js 5.05 kB 0 B
packages/react-native/dist/error-tracking/index.js 7.24 kB 0 B
packages/react-native/dist/error-tracking/utils.js 2.58 kB 0 B
packages/react-native/dist/frameworks/wix-navigation.js 1.3 kB 0 B
packages/react-native/dist/hooks/useFeatureFlag.js 1.7 kB 0 B
packages/react-native/dist/hooks/useFeatureFlagResult.js 963 B 0 B
packages/react-native/dist/hooks/useFeatureFlags.js 921 B 0 B
packages/react-native/dist/hooks/useNavigationTracker.js 2.45 kB 0 B
packages/react-native/dist/hooks/usePostHog.js 544 B 0 B
packages/react-native/dist/hooks/utils.js 988 B 0 B
packages/react-native/dist/index.js 4.33 kB 0 B
packages/react-native/dist/native-deps.js 8.77 kB 0 B
packages/react-native/dist/optional/OptionalAsyncStorage.js 299 B 0 B
packages/react-native/dist/optional/OptionalExpoApplication.js 377 B 0 B
packages/react-native/dist/optional/OptionalExpoDevice.js 347 B 0 B
packages/react-native/dist/optional/OptionalExpoFileSystem.js 386 B 0 B
packages/react-native/dist/optional/OptionalExpoFileSystemLegacy.js 423 B 0 B
packages/react-native/dist/optional/OptionalExpoLocalization.js 383 B 0 B
packages/react-native/dist/optional/OptionalReactNativeDeviceInfo.js 415 B 0 B
packages/react-native/dist/optional/OptionalReactNativeLocalize.js 303 B 0 B
packages/react-native/dist/optional/OptionalReactNativeNavigation.js 415 B 0 B
packages/react-native/dist/optional/OptionalReactNativeNavigationWix.js 443 B 0 B
packages/react-native/dist/optional/OptionalReactNativeSafeArea.js 644 B 0 B
packages/react-native/dist/optional/OptionalSessionReplay.js 455 B 0 B
packages/react-native/dist/posthog-rn.js 39.7 kB 0 B
packages/react-native/dist/PostHogContext.js 329 B 0 B
packages/react-native/dist/PostHogErrorBoundary.js 3.19 kB 0 B
packages/react-native/dist/PostHogMaskView.js 1.66 kB 0 B
packages/react-native/dist/PostHogProvider.js 4.76 kB 0 B
packages/react-native/dist/storage.js 4.49 kB 0 B
packages/react-native/dist/surveys/components/BottomSection.js 1.46 kB 0 B
packages/react-native/dist/surveys/components/Cancel.js 909 B 0 B
packages/react-native/dist/surveys/components/ConfirmationMessage.js 1.65 kB 0 B
packages/react-native/dist/surveys/components/QuestionHeader.js 1.37 kB 0 B
packages/react-native/dist/surveys/components/QuestionTypes.js 12.7 kB 0 B
packages/react-native/dist/surveys/components/SurveyModal.js 4.01 kB 0 B
packages/react-native/dist/surveys/components/Surveys.js 7.22 kB 0 B
packages/react-native/dist/surveys/getActiveMatchingSurveys.js 2.64 kB 0 B
packages/react-native/dist/surveys/icons.js 8.86 kB 0 B
packages/react-native/dist/surveys/index.js 600 B 0 B
packages/react-native/dist/surveys/PostHogSurveyProvider.js 5.71 kB 0 B
packages/react-native/dist/surveys/surveys-utils.js 12.7 kB 0 B
packages/react-native/dist/surveys/useActivatedSurveys.js 3.67 kB 0 B
packages/react-native/dist/surveys/useSurveyStorage.js 2.16 kB 0 B
packages/react-native/dist/tooling/expoconfig.js 2.63 kB 0 B
packages/react-native/dist/tooling/metroconfig.js 2.32 kB 0 B
packages/react-native/dist/tooling/posthogMetroSerializer.js 4.86 kB 0 B
packages/react-native/dist/tooling/utils.js 4.05 kB 0 B
packages/react-native/dist/tooling/vendor/expo/expoconfig.js 70 B 0 B
packages/react-native/dist/tooling/vendor/metro/countLines.js 237 B 0 B
packages/react-native/dist/tooling/vendor/metro/utils.js 3.35 kB 0 B
packages/react-native/dist/types.js 70 B 0 B
packages/react-native/dist/utils.js 1.14 kB 0 B
packages/react-native/dist/version.js 130 B 0 B
packages/react/dist/esm/index.js 20.7 kB 0 B
packages/react/dist/esm/surveys/index.js 4.54 kB 0 B
packages/react/dist/umd/index.js 24 kB 0 B
packages/react/dist/umd/surveys/index.js 5.49 kB 0 B
packages/rollup-plugin/dist/index.js 2.11 kB 0 B
packages/types/dist/capture.js 603 B 0 B
packages/types/dist/capture.mjs 0 B 0 B 🆕
packages/types/dist/common.js 603 B 0 B
packages/types/dist/common.mjs 0 B 0 B 🆕
packages/types/dist/feature-flags.js 603 B 0 B
packages/types/dist/feature-flags.mjs 0 B 0 B 🆕
packages/types/dist/index.js 603 B 0 B
packages/types/dist/index.mjs 0 B 0 B 🆕
packages/types/dist/posthog-config.js 603 B 0 B
packages/types/dist/posthog-config.mjs 0 B 0 B 🆕
packages/types/dist/posthog.js 603 B 0 B
packages/types/dist/posthog.mjs 0 B 0 B 🆕
packages/types/dist/request.js 603 B 0 B
packages/types/dist/request.mjs 0 B 0 B 🆕
packages/types/dist/segment.js 603 B 0 B
packages/types/dist/segment.mjs 0 B 0 B 🆕
packages/types/dist/session-recording.js 603 B 0 B
packages/types/dist/session-recording.mjs 0 B 0 B 🆕
packages/types/dist/survey.js 603 B 0 B
packages/types/dist/survey.mjs 0 B 0 B 🆕
packages/types/dist/toolbar.js 603 B 0 B
packages/types/dist/toolbar.mjs 0 B 0 B 🆕
packages/types/dist/tree-shakeable.js 603 B 0 B
packages/types/dist/tree-shakeable.mjs 0 B 0 B 🆕
packages/web/dist/index.cjs 13.8 kB 0 B
packages/web/dist/index.mjs 13.7 kB 0 B
packages/webpack-plugin/dist/config.js 1.52 kB 0 B
packages/webpack-plugin/dist/config.mjs 543 B 0 B
packages/webpack-plugin/dist/index.js 5.38 kB 0 B
packages/webpack-plugin/dist/index.mjs 2.04 kB 0 B
tooling/changelog/dist/index.js 3.31 kB 0 B
tooling/rollup-utils/dist/index.js 1.17 kB 0 B

compressed-size-action

@marandaneto
Copy link
Copy Markdown
Member

On my phone now and didnt review the code yet but i remember some sdks cache person props during the identify call and reload flags with all new/cached props so the reload flags should be evaluated correctly already.

@promptless
Copy link
Copy Markdown

promptless bot commented Mar 28, 2026

Promptless prepared a documentation update related to this change.

Documents the new disableFeatureFlagReload option for the identify() method, explaining when to use it to avoid race conditions during person merges.

Review at https://app.gopromptless.ai/suggestions/1db8181d-33d2-46f5-a72e-89e8f9a751e4

@marandaneto
Copy link
Copy Markdown
Member

On my phone now and didnt review the code yet but i remember some sdks cache person props during the identify call and reload flags with all new/cached props so the reload flags should be evaluated correctly already.

i think @dustinbyrne implemented that for a few SDKs

@dustinbyrne
Copy link
Copy Markdown
Contributor

Yeah, I'd expect this to be working already without the need to defer reload, otherwise it's a bug. Is this related to experience continuity flags or are you seeing this happen elsewhere?

@dmarticus
Copy link
Copy Markdown
Contributor Author

You're both right — I hadn't looked closely enough. The core SDK already sends $anon_distinct_id with the /flags request after identify, and the server handles EEC flags correctly with it. The race condition I was worried about doesn't exist.

Going back to the customer to investigate further. Their setup has three distinct IDs (RN SDK anonymous ID, backend-generated UUID, and Auth0 UUID) with two separate merge paths — the variant flip is likely coming from the backend evaluating flags against a different ID than the frontend during the anonymous phase, not from a client-side reload issue.

Closing this.

@dmarticus dmarticus closed this Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants