Skip to content

refactor: react contract tests#1226

Merged
joker23 merged 1 commit intomainfrom
skz/sdk-2006/react-contract-test-continued
Mar 31, 2026
Merged

refactor: react contract tests#1226
joker23 merged 1 commit intomainfrom
skz/sdk-2006/react-contract-test-continued

Conversation

@joker23
Copy link
Copy Markdown
Contributor

@joker23 joker23 commented Mar 25, 2026

This PR will:

  • move some variable around for the react SDK so it is a bit more readable in my opinion

Context

This PR is the result of some exploration on how to make the react contract more idiomatic to react. A few things that I looked into:

  • changing evaluation to useVariation flags
  • changing some of the internal commands to use react hooks
  • removing some of the useRef

Ultimately, most of the exploration did not yield a good result because they require very verbose changes. A lot of the code consolidation, I think, should be consolidated into the shared contract test tooling package.


Note

Medium Risk
Moves client/handler bookkeeping from React state/refs to module-level globals with manual re-rendering, which could introduce lifecycle/state-leak issues across mounts or tests. Changes are limited to contract-test harness code, but affect client creation/deletion and command routing timing.

Overview
Refactors the React contract-test harness to manage clients and command handlers via module-level Maps/arrays instead of useRef/component state, triggering UI updates via a simple render tick.

Client creation/deletion now updates global clientRecords and uses a shared onReady resolver map to coordinate when ClientInstance has registered its command handler before returning the client id. Also removes a stale comment in ClientEntity.ts.

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


Open with Devin

@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25661 bytes
Compressed size limit: 29000
Uncompressed size: 126143 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31446 bytes
Compressed size limit: 34000
Uncompressed size: 111621 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

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

@joker23 joker23 force-pushed the skz/sdk-2006/react-contract-test-continued branch 3 times, most recently from 047a537 to 4c460b7 Compare March 30, 2026 16:49
@joker23 joker23 force-pushed the skz/sdk-2006/react-contract-test-continued branch from 4c460b7 to 14cef1f Compare March 30, 2026 17:20
@joker23
Copy link
Copy Markdown
Contributor Author

joker23 commented Mar 30, 2026

@cursor review

Copy link
Copy Markdown

@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 30, 2026 18:13
@joker23 joker23 requested a review from a team as a code owner March 30, 2026 18:13
Copy link
Copy Markdown
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 2 additional findings.

Open in Devin Review

@joker23 joker23 merged commit e53949e into main Mar 31, 2026
47 checks passed
@joker23 joker23 deleted the skz/sdk-2006/react-contract-test-continued branch March 31, 2026 22:19
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.

2 participants