Skip to content

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

Merged
EmilianoSanchez merged 21 commits into
clients_without_ttfrom
issue_198_factory_available_in_initial_render
Oct 31, 2024
Merged

[Breaking change] factory, client, and track method available in initial render when using config prop.#211
EmilianoSanchez merged 21 commits into
clients_without_ttfrom
issue_198_factory_available_in_initial_render

Conversation

@EmilianoSanchez

@EmilianoSanchez EmilianoSanchez commented Oct 24, 2024

Copy link
Copy Markdown
Contributor

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
@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