Skip to content

Commit

Permalink
add comment about useTrack implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoSanchez committed Oct 5, 2023
1 parent a85623b commit 5c5274b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/useTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const noOpFalse = () => false;
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#track}
*/
export function useTrack(key?: SplitIO.SplitKey, trafficType?: string): SplitIO.IBrowserClient['track'] {
// All update options are false to avoid re-renders. The track method doesn't need the client to be operational.
const client = useClient(key, trafficType, undefined, { updateOnSdkReady: false, updateOnSdkReadyFromCache: false });
return client ? client.track.bind(client) : noOpFalse;
}

0 comments on commit 5c5274b

Please sign in to comment.