Skip to content

Commit 29d572e

Browse files
Merge pull request #195 from splitio/eventemitter_warning
Remove EventEmitter max listeners warning to avoid a false memory leak warning
2 parents 38a1f57 + 08711d9 commit 29d572e

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- Added support for targeting rules based on semantic versions (https://semver.org/).
44
- Added special impression label "targeting rule type unsupported by sdk" when the matcher type is not supported by the SDK, which returns 'control' treatment.
55
- Updated Split API client to include the flags spec version query parameter for the `splitChanges` and `auth` endpoints.
6+
- Updated internal use of the SDK client to remove EventEmitter memory leak warnings. These warnings were emitted when using multiple hooks and components from the SDK simultaneously, but they do not indicate an actual memory leak and are irrelevant for SDK usage (Related to https://github.com/splitio/react-client/issues/191).
67

78
1.11.1 (March 26, 2024)
89
- Bugfixing - Added tslib as an explicit dependency to avoid issues with some package managers that don't resolve it automatically as a transitive dependency from @splitsoftware/splitio-commons (Related to issue https://github.com/splitio/javascript-client/issues/795).

src/utils.ts

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ export function getSplitClient(factory: SplitIO.IBrowserSDK, key?: SplitIO.Split
5353

5454
// Handle client lastUpdate
5555
if (client.lastUpdate === undefined) {
56+
// Remove EventEmitter warning emitted when using multiple SDK hooks or components.
57+
// Unlike JS SDK, users can avoid using the client directly, making the warning irrelevant.
58+
client.setMaxListeners(0);
59+
5660
const updateLastUpdate = () => {
5761
const lastUpdate = Date.now();
5862
client.lastUpdate = lastUpdate > client.lastUpdate ? lastUpdate : client.lastUpdate + 1;

tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
1919
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
2020
},
21-
"include": ["src"],
21+
"include": [
22+
"src"
23+
],
2224
"exclude": [
2325
"./src/__tests__",
2426
"umd.ts",

0 commit comments

Comments
 (0)