Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Breaking change] factory, client, and track method available in initial render when using config prop. #211

Merged

Conversation

EmilianoSanchez
Copy link
Contributor

@EmilianoSanchez EmilianoSanchez commented Oct 24, 2024

React SDK

What did you accomplish?

  • When the config prop is provided, the SplitFactoryProvider now makes the SDK factory and client instances available in the context immediately during the initial render, instead of waiting for the first SDK event. This change:

    • fixes a behavior in the useTrack hook, which was retrieving a no-op function instead of the client's track method during the initial render.
    • allows implementing Suspense support in hooks when using the config prop.
  • Updated the useTrack hook to retrieve the client track reference rather than a bound version of it, as there is no need to bind the function. By retrieving the same reference per client, it can be used as a reactive dependency in useEffect, which only changes if the underlying client changes.

How do we test the changes introduced in this PR?

  • Unit tests.

Extra Notes

Related to #198 and #192

@EmilianoSanchez EmilianoSanchez requested a review from a team as a code owner October 24, 2024 03:03
@EmilianoSanchez EmilianoSanchez merged commit 3b3eabc into clients_without_tt Oct 31, 2024
1 check failed
@EmilianoSanchez EmilianoSanchez deleted the issue_198_factory_available_in_initial_render branch October 31, 2024 17:36
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