Skip to content

refactor: simplify getting initializationState#1202

Open
joker23 wants to merge 1 commit intomainfrom
skz/sdk-1945/initialize-state-tracking
Open

refactor: simplify getting initializationState#1202
joker23 wants to merge 1 commit intomainfrom
skz/sdk-1945/initialize-state-tracking

Conversation

@joker23
Copy link
Contributor

@joker23 joker23 commented Mar 18, 2026

This PR will align our initialization status handling closer to the base browser sdk by:

  • combining initializing and unknown state which should get rid of one extra state dispatch on initialization
  • adding additional idempotent guards to the start function. Note that these are redundant protections.

Open with Devin

Note

Medium Risk
Changes the public initialization-state contract by removing the unknown state and adjusting when context-change subscribers are notified, which could affect apps gating rendering on the previous state transitions.

Overview
Unifies initialization state handling by removing the unknown state and treating clients as initializing until start() resolves (InitializedState and useInitializationStatus updated accordingly).

Refactors LDReactClient.start() semantics to be explicitly idempotent via internal guards and to notify onContextChange subscribers once after the first successful start() completion; identify() reuses the same notification path.

Updates mocks, tests, and migration docs to reflect the new initial status (initializing) and the dropped unknown branch.

Written by Cursor Bugbot for commit 2da69a5. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25566 bytes
Compressed size limit: 26000
Uncompressed size: 125383 bytes

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 24546 bytes
Compressed size limit: 25000
Uncompressed size: 85156 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 22203 bytes
Compressed size limit: 24000
Uncompressed size: 115238 bytes

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 172365 bytes
Compressed size limit: 200000
Uncompressed size: 802275 bytes

@joker23 joker23 force-pushed the skz/sdk-1945/initialize-state-tracking branch 2 times, most recently from a5d4d5f to 85fce1b Compare March 18, 2026 23:35
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@joker23
Copy link
Contributor Author

joker23 commented Mar 19, 2026

@cursor review

cursor[bot]

This comment was marked as resolved.

@joker23 joker23 force-pushed the skz/sdk-1945/initialize-state-tracking branch from 85fce1b to d710974 Compare March 19, 2026 19:08
@joker23 joker23 force-pushed the skz/sdk-1945/initialize-state-tracking branch from d710974 to 2da69a5 Compare March 19, 2026 19:38
@joker23
Copy link
Contributor Author

joker23 commented Mar 19, 2026

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@joker23 joker23 marked this pull request as ready for review March 19, 2026 20:11
@joker23 joker23 requested a review from a team as a code owner March 19, 2026 20:11
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