Skip to content

Commit

Permalink
Merge pull request #107 from splitio/development
Browse files Browse the repository at this point in the history
Release v1.12.0
  • Loading branch information
EmilianoSanchez authored May 10, 2024
2 parents 7560bea + 63e02ad commit 5189e9e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 21 deletions.
7 changes: 7 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.12.0 (May 10, 2024)
- Updated @splitsoftware/splitio package to version 10.26.0 that includes minor updates:
- Added support for targeting rules based on semantic versions (https://semver.org/).
- Added special impression label "targeting rule type unsupported by sdk" when the matcher type is not supported by the SDK, which returns 'control' treatment.
- Updated Split API client to include the flags spec version query parameter for the `splitChanges` and `auth` endpoints.
- Bugfixing - Fixed error when calling `selectTreatmentValue` and `selectTreatmentWithConfig` selectors with an object as a key, caused by the key being stringified rather than using the `matchingKey` property of the object.

1.11.0 (April 3, 2024)
- Added `sideEffects: false` property in the package.json file to allow tree shaking.
- Updated Redux-Thunk peer dependency range to include [email protected].
Expand Down
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@splitsoftware/splitio-redux",
"version": "1.11.0",
"version": "1.12.0",
"description": "A library to easily use Split JS SDK with Redux and React Redux",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down Expand Up @@ -59,7 +59,7 @@
},
"homepage": "https://github.com/splitio/redux-client#readme",
"dependencies": {
"@splitsoftware/splitio": "10.25.2",
"@splitsoftware/splitio": "10.26.0",
"tslib": "^2.3.1"
},
"devDependencies": {
Expand Down
7 changes: 6 additions & 1 deletion src/__tests__/selectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ describe('selectTreatmentValue', () => {
it('returns the treatment value of the given feature flag name and key', () => {
/** The treatment value for the USER_1 key for SPLIT_1 is 'off' */
expect(selectTreatmentValue(STATE_READY.splitio, SPLIT_2, USER_1)).toBe(OFF);
// Using a key object
expect(selectTreatmentValue(STATE_READY.splitio, SPLIT_2, { matchingKey: USER_1, bucketingKey: 'some_bucket' })).toBe(OFF); // @ts-expect-error bucketingKey is not in SplitKey type, but it's not used in the selector
expect(selectTreatmentValue(STATE_READY.splitio, SPLIT_2, { matchingKey: USER_1 })).toBe(OFF);
});

it('returns "control" value if the given feature flag name or key are invalid (were not evaluated with getTreatment, or returned "control"', () => {
Expand All @@ -46,6 +49,8 @@ describe('selectTreatmentWithConfig', () => {

it('returns the treatment of the given feature flag name and key', () => {
expect(selectTreatmentWithConfig(STATE_READY.splitio, SPLIT_2, USER_1)).toBe(STATE_READY.splitio.treatments[SPLIT_2][USER_1]);
// Using a key object
expect(selectTreatmentWithConfig(STATE_READY.splitio, SPLIT_2, { matchingKey: USER_1, bucketingKey: 'some_bucket' })).toBe(STATE_READY.splitio.treatments[SPLIT_2][USER_1]);
});

it('returns "control" treatment if the given feature flag name or key are invalid (were not evaluated with getTreatment, or returned "control")', () => {
Expand All @@ -54,7 +59,7 @@ describe('selectTreatmentWithConfig', () => {
});

it('returns the passed default treatment insteaad of "control" if the given feature flag name or key are invalid', () => {
const DEFAULT_TREATMENT = {treatment: 'some_value', config: 'some_config'};
const DEFAULT_TREATMENT = { treatment: 'some_value', config: 'some_config' };

expect(selectTreatmentWithConfig(STATE_READY.splitio, SPLIT_1, USER_INVALID, DEFAULT_TREATMENT)).toBe(DEFAULT_TREATMENT);
expect(selectTreatmentWithConfig(STATE_READY.splitio, SPLIT_INVALID, USER_1, DEFAULT_TREATMENT)).toBe(DEFAULT_TREATMENT);
Expand Down
3 changes: 2 additions & 1 deletion src/selectors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ISplitState } from './types';
import { CONTROL, CONTROL_WITH_CONFIG, DEFAULT_SPLIT_STATE_SLICE, ERROR_SELECTOR_NO_SPLITSTATE } from './constants';
import { matching } from './utils';

export const getStateSlice = (sliceName: string) => (state: any) => state[sliceName];

Expand Down Expand Up @@ -30,7 +31,7 @@ export function selectTreatmentWithConfig(splitState: ISplitState, featureFlagNa
const treatment =
splitTreatments ?
key ?
splitTreatments[key.toString()] :
splitTreatments[matching(key)] :
Object.values(splitTreatments)[0] :
undefined;

Expand Down

0 comments on commit 5189e9e

Please sign in to comment.