|
1 | 1 | import React from 'react'; |
2 | 2 | import { SplitContext } from './SplitContext'; |
3 | 3 | import { ISplitClientProps, ISplitContextValues, IUpdateProps } from './types'; |
4 | | -import { ERROR_SC_NO_FACTORY } from './constants'; |
5 | 4 | import { getStatus, getSplitClient, initAttributes, IClientWithContext } from './utils'; |
6 | 5 | import { DEFAULT_UPDATE_OPTIONS } from './useSplitClient'; |
7 | 6 |
|
8 | 7 | /** |
9 | 8 | * Common component used to handle the status and events of a Split client passed as prop. |
10 | | - * Reused by both SplitFactory (main client) and SplitClient (shared client) components. |
| 9 | + * Reused by both SplitFactoryProvider (main client) and SplitClient (any client) components. |
11 | 10 | */ |
12 | 11 | export class SplitComponent extends React.Component<IUpdateProps & { factory: SplitIO.IBrowserSDK | null, client: SplitIO.IBrowserClient | null, attributes?: SplitIO.Attributes, children: any }, ISplitContextValues> { |
13 | 12 |
|
@@ -47,11 +46,6 @@ export class SplitComponent extends React.Component<IUpdateProps & { factory: Sp |
47 | 46 | super(props); |
48 | 47 | const { factory, client } = props; |
49 | 48 |
|
50 | | - // Log error if factory is not available |
51 | | - if (!factory) { |
52 | | - console.error(ERROR_SC_NO_FACTORY); |
53 | | - } |
54 | | - |
55 | 49 | this.state = { |
56 | 50 | factory, |
57 | 51 | client, |
@@ -129,9 +123,8 @@ export class SplitComponent extends React.Component<IUpdateProps & { factory: Sp |
129 | 123 | * SplitClient will initialize a new SDK client and listen for its events in order to update the Split Context. |
130 | 124 | * Children components will have access to the new client when accessing Split Context. |
131 | 125 | * |
132 | | - * Unlike SplitFactory, the underlying SDK client can be changed during the component lifecycle |
133 | | - * if the component is updated with a different splitKey or trafficType prop. Since the client can change, |
134 | | - * its release is not handled by SplitClient but by its container SplitFactory component. |
| 126 | + * The underlying SDK client can be changed during the component lifecycle |
| 127 | + * if the component is updated with a different splitKey or trafficType prop. |
135 | 128 | * |
136 | 129 | * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#advanced-instantiate-multiple-sdk-clients} |
137 | 130 | */ |
|
0 commit comments