Skip to content

fix(browser): clear persisted featureFlags group properties on resetGroups (#5673) - #5749

Open
VaibhavBajpaij wants to merge 1 commit into
PostHog:mainfrom
VaibhavBajpaij:fix/reset-groups-clear-flag-properties
Open

VaibhavBajpaij wants to merge 1 commit into
PostHog:mainfrom
VaibhavBajpaij:fix/reset-groups-clear-flag-properties

Conversation

@VaibhavBajpaij

Copy link
Copy Markdown

Summary

Fixes #5673. Follow-up to #5655.

In experimental @posthog/browser, analytics.resetGroups() cleared group membership but retained persisted group properties used for flag evaluation ($stored_group_properties in this._state.extensionData['featureFlags']) when the flags product is absent. If a later client installed flags, that retained context would be sent again.

Changes

  • In packages/browser-next/src/state.ts, updated BrowserState.resetGroups() to durably remove $stored_group_properties from the featureFlags extension storage namespace during group reset.
  • Retains identity, session context, person properties, and other unrelated flag storage intact.
  • Preserves Core ownership of reset cleanup without requiring the flags implementation to be loaded.
  • Added regression test in packages/browser-next/tests/identity-helpers.spec.ts verifying that persisted $stored_group_properties are cleared on resetGroups() and stay cleared across storage reloads.

…roups

In experimental @posthog/browser, analytics.resetGroups() cleared group
membership but left persisted group properties used for flag evaluation
in extensionData['featureFlags']['$stored_group_properties'] when the flags
product was absent.

Ensure resetGroups() durably clears $stored_group_properties from the
featureFlags extensionData namespace in Core state, so group-only reset
consistently removes both memberships and group property overrides
independently of whether the flags extension is installed.

Fixes PostHog#5673

Signed-off-by: Vaibhav Bajpai <bajpaivaibhav2005@gmail.com>
@VaibhavBajpaij
VaibhavBajpaij requested a review from a team as a code owner November 15, 2026 19:21

This branch has not been deployed

No deployments
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.

[browser-next] resetGroups retains persisted group flag properties when flags is absent

1 participant