Skip to content

Commit b00889f

Browse files
authored
fix: Report data source state as valid after bootstrap (#1203)
<!-- CURSOR_SUMMARY --> > [!NOTE] > **Low Risk** > Low risk: a small state-reporting change limited to the bootstrap identify path, covered by an updated unit test asserting the `dataSourceStatus` event. > > **Overview** > When `identify` completes using `bootstrap` data, `BrowserDataManager` now explicitly reports the data source status as **valid** by calling `dataSourceStatusManager.requestStateUpdate(DataSourceState.Valid)`. > > The bootstrap identify unit test is updated to assert that a `dataSourceStatus` event is emitted with `state: 'VALID'` after bootstrap initialization. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 6d3276f. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 9250766 commit b00889f

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

packages/sdk/browser/__tests__/BrowserDataManager.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ describe('given a BrowserDataManager with mocked dependencies', () => {
396396
});
397397
expect(platform.requests.createEventSource).not.toHaveBeenCalled();
398398
expect(platform.requests.fetch).not.toHaveBeenCalled();
399+
expect(emitter.emit).toHaveBeenCalledWith(
400+
'dataSourceStatus',
401+
expect.objectContaining({ state: 'VALID' }),
402+
);
399403
});
400404

401405
it('should identify from polling when there are no cached flags', async () => {

packages/sdk/browser/src/BrowserDataManager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ export default class BrowserDataManager extends BaseDataManager {
196196
bootstrapParsed = readFlagsFromBootstrap(this.logger, browserIdentifyOptions.bootstrap);
197197
}
198198
this.flagManager.setBootstrap(context, bootstrapParsed);
199+
this.dataSourceStatusManager.requestStateUpdate(DataSourceState.Valid);
199200
this._debugLog('Identify - Initialization completed from bootstrap');
200201
identifyResolve();
201202
}

0 commit comments

Comments
 (0)