Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoSanchez committed Nov 1, 2024
1 parent 28c4b1b commit 62741e8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 33 deletions.
2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- Updated the handling of timers and async operations inside an `init` factory method to enable lazy initialization of the SDK in standalone mode. This update is intended for the React SDK.
- Bugfixing - Fixed an issue with the server-side polling manager that caused dangling timers when the SDK was destroyed before it was ready.
- BREAKING CHANGES:
- Updated default flag spec version to 1.2.
- Updated default flag spec version to 1.2, which requires Split Proxy v5.9.0 or higher.
- Removed `/mySegments` endpoint from SplitAPI module, as it is replaced by `/memberships` endpoint.
- Removed support for MY_SEGMENTS_UPDATE and MY_SEGMENTS_UPDATE_V2 notification types, as they are replaced by MEMBERSHIPS_MS_UPDATE and MEMBERSHIPS_LS_UPDATE notification types.
- Removed the deprecated `GOOGLE_ANALYTICS_TO_SPLIT` and `SPLIT_TO_GOOGLE_ANALYTICS` integrations.
Expand Down
3 changes: 1 addition & 2 deletions src/__tests__/testUtils/fetchMock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @TODO upgrade fetch-mock when fetch-mock-jest vulnerabilities are fixed
// https://www.wheresrhys.co.uk/fetch-mock/docs/fetch-mock/Usage/cheatsheet#local-fetch-with-jest
// @TODO upgrade fetch-mock to fix vulnerabilities
import fetchMockLib from 'fetch-mock';

const fetchMock = fetchMockLib.sandbox();
Expand Down
8 changes: 4 additions & 4 deletions src/readiness/readinessManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function splitsEventEmitterFactory(EventEmitter: new () => SplitIO.IEventEmitter
const splitsEventEmitter = objectAssign(new EventEmitter(), {
splitsArrived: false,
splitsCacheLoaded: false,
initialized: false,
hasInit: false,
initCallbacks: []
});

Expand Down Expand Up @@ -68,7 +68,7 @@ export function readinessManagerFactory(

let readyTimeoutId: ReturnType<typeof setTimeout>;
if (readyTimeout > 0) {
if (splits.initialized) readyTimeoutId = setTimeout(timeout, readyTimeout);
if (splits.hasInit) readyTimeoutId = setTimeout(timeout, readyTimeout);
else splits.initCallbacks.push(() => { readyTimeoutId = setTimeout(timeout, readyTimeout); });
}

Expand Down Expand Up @@ -137,8 +137,8 @@ export function readinessManagerFactory(
setDestroyed() { isDestroyed = true; },

init() {
if (splits.initialized) return;
splits.initialized = true;
if (splits.hasInit) return;
splits.hasInit = true;
splits.initCallbacks.forEach(cb => cb());
},

Expand Down
2 changes: 1 addition & 1 deletion src/readiness/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface ISplitsEventEmitter extends SplitIO.IEventEmitter {
once(event: ISplitsEvent, listener: (...args: any[]) => void): this;
splitsArrived: boolean
splitsCacheLoaded: boolean
initialized: boolean,
hasInit: boolean,
initCallbacks: (() => void)[]
}

Expand Down
25 changes: 0 additions & 25 deletions temp.ts

This file was deleted.

0 comments on commit 62741e8

Please sign in to comment.