Skip to content

Commit fdda27f

Browse files
Remove EventEmitter max listeners warning
1 parent 599f6d5 commit fdda27f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
1.11.2 (May XX, 2024)
2+
- Updated internal use of the SDK client to remove EventEmitter memory leak warnings. These warnings are 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).
3+
14
1.11.1 (March 26, 2024)
25
- 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).
36

src/utils.ts

Lines changed: 4 additions & 0 deletions
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 don't need to use the client directly and so the warning is not relevant.
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

Lines changed: 3 additions & 1 deletion
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)