Skip to content

fix(browser-sdk): start automatic feedback when the first user ID arrives - #848

Merged
roncohen merged 3 commits into
mainfrom
fix/auto-feedback-late-user
Dec 1, 2026
Merged

roncohen merged 3 commits into
mainfrom
fix/auto-feedback-late-user

Conversation

@roncohen

@roncohen roncohen commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A Browser SDK client only set up automatic feedback surveys if it was created with a user. If an app created the client before sign-in and set the user later with setContext() or updateUser(), surveys never showed. This affects the React, Vue and React Native SDKs too, since they use the Browser client.

Fix

  • When a user ID first appears, the client now sets up automatic feedback with the same options it would have used at startup (enableAutoFeedback, the prompt handler, position and translations). Offline, server-side and mobile behavior are unchanged.
  • If the client is already running, it opens the live connection that delivers survey prompts, or reopens it with the new user if live updates already had one open.
  • If the user is set before initialize(), initialize() opens the connection as usual.

Tests

New cases in test/feedback-context.test.ts:

  • a client with no user that gets one later, with live updates off and on;
  • a user set before initialize();
  • enableAutoFeedback: false staying off.

All three cases fail without the fix. The Browser SDK suite passes, apart from the two release tests that need the React and Node packages built locally.

OpenFeature Browser provider

#847 made the provider stop its client and start a new one when the first user ID arrived, so that feedback would start. With this fix, the provider just updates the existing client's context, so that restart and its bootstrap handling are removed.

@reflag-review reflag-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk: medium

1 actionable finding.

Comment thread packages/browser-sdk/src/client.ts Resolved
@roncohen
roncohen force-pushed the fix/auto-feedback-late-user branch from 50b2d4f to 6cce24d Compare November 30, 2026 21:29

@reflag-review reflag-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk: medium

no actionable findings

@roncohen
roncohen enabled auto-merge December 1, 2026 06:40

@reflag-review reflag-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk: medium

no actionable findings

@roncohen
roncohen added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit c4b6b44 Dec 1, 2026
9 checks passed
@roncohen
roncohen deleted the fix/auto-feedback-late-user branch December 1, 2026 06:52
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.

1 participant