Skip to content

Commit 8c61166

Browse files
committed
Remove UPDATE_CONTEXTUAL_ENTITIES_OPTIONS action
This action store a value to a variable in the store which is no longer consumed.
1 parent 2bc8ee4 commit 8c61166

File tree

7 files changed

+0
-53
lines changed

7 files changed

+0
-53
lines changed

@types/index.d.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ declare namespace EntitiesSearch {
117117
> extends Readonly<{
118118
entities: Entities<E>;
119119
kind: Kind<K>;
120-
contextualEntitiesOptions: OptionSet;
121120
currentEntitiesOptions: OptionSet;
122121
selectedEntitiesOptions: OptionSet;
123122
searchPhrase: string;
@@ -139,13 +138,6 @@ declare namespace EntitiesSearch {
139138
K
140139
>['currentEntitiesOptions'];
141140
}
142-
| {
143-
type: 'UPDATE_CONTEXTUAL_ENTITIES_OPTIONS';
144-
contextualEntitiesOptions: EntitiesState<
145-
E,
146-
K
147-
>['contextualEntitiesOptions'];
148-
}
149141
| {
150142
type: 'UPDATE_SELECTED_ENTITIES_OPTIONS';
151143
selectedEntitiesOptions: EntitiesState<

sources/client/src/hooks/use-entities-options-storage.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ export function useEntitiesOptionsStorage< E, K >(
6363
type: 'UPDATE_SELECTED_ENTITIES_OPTIONS',
6464
selectedEntitiesOptions,
6565
} );
66-
dispatch( {
67-
type: 'UPDATE_CONTEXTUAL_ENTITIES_OPTIONS',
68-
contextualEntitiesOptions: currentEntitiesOptions,
69-
} );
7066
dispatch( {
7167
type: 'UPDATE_CURRENT_ENTITIES_OPTIONS',
7268
currentEntitiesOptions,

sources/client/src/storage/entities/initial-state.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export function makeInitialState< E, K >(
2020
return {
2121
entities: new Set< E >( [] ),
2222
kind: new Set< K >( [] ),
23-
contextualEntitiesOptions: new Set< Options< E > >(),
2423
currentEntitiesOptions: new Set< Options< E > >(),
2524
selectedEntitiesOptions: new Set< Options< E > >(),
2625
searchPhrase: '',

sources/client/src/storage/entities/reducer.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ export function reducer< E, K >(
3030
kind: action.kind,
3131
};
3232

33-
case 'UPDATE_CONTEXTUAL_ENTITIES_OPTIONS':
34-
return {
35-
...state,
36-
contextualEntitiesOptions: action.contextualEntitiesOptions,
37-
};
38-
3933
case 'UPDATE_CURRENT_ENTITIES_OPTIONS':
4034
return {
4135
...state,
@@ -56,14 +50,12 @@ export function reducer< E, K >(
5650
return {
5751
...state,
5852
selectedEntitiesOptions: new Set(),
59-
contextualEntitiesOptions: new Set(),
6053
currentEntitiesOptions: new Set(),
6154
};
6255

6356
case 'UPDATE_ENTITIES_OPTIONS_FOR_NEW_KIND':
6457
return {
6558
...state,
66-
contextualEntitiesOptions: action.entitiesOptions,
6759
currentEntitiesOptions: action.entitiesOptions,
6860
selectedEntitiesOptions: new Set(),
6961
entities: new Set(),

tests/client/unit/hooks/use-entities-options-storage.test.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,6 @@ describe( 'Use Posts Options Storage', () => {
131131
type: 'UPDATE_SELECTED_ENTITIES_OPTIONS',
132132
selectedEntitiesOptions,
133133
} );
134-
expect( dispatch ).toHaveBeenCalledWith( {
135-
type: 'UPDATE_CONTEXTUAL_ENTITIES_OPTIONS',
136-
contextualEntitiesOptions: currentEntitiesOptions,
137-
} );
138134
expect( dispatch ).toHaveBeenCalledWith( {
139135
type: 'UPDATE_CURRENT_ENTITIES_OPTIONS',
140136
currentEntitiesOptions,
@@ -175,10 +171,6 @@ describe( 'Use Posts Options Storage', () => {
175171
type: 'UPDATE_SELECTED_ENTITIES_OPTIONS',
176172
selectedEntitiesOptions: expectedSet,
177173
} );
178-
expect( dispatch ).toHaveBeenCalledWith( {
179-
type: 'UPDATE_CONTEXTUAL_ENTITIES_OPTIONS',
180-
contextualEntitiesOptions: expectedSet,
181-
} );
182174
expect( dispatch ).toHaveBeenCalledWith( {
183175
type: 'UPDATE_CURRENT_ENTITIES_OPTIONS',
184176
currentEntitiesOptions: expectedSet,

tests/client/unit/storage/initial-state.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { makeInitialState } from '../../../../sources/client/src/storage/entitie
1111
describe( 'Initial state', () => {
1212
it( 'ensure all options are empty', () => {
1313
const initialState = makeInitialState( {} );
14-
expect( initialState.contextualEntitiesOptions.length() ).toBe( 0 );
1514
expect( initialState.currentEntitiesOptions.length() ).toBe( 0 );
1615
expect( initialState.selectedEntitiesOptions.length() ).toBe( 0 );
1716
} );

tests/client/unit/storage/reducer.test.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,6 @@ describe( 'reducer', () => {
3636
expect( newState.kind ).toEqual( kind );
3737
} );
3838

39-
it( 'Update the Contextual Posts Options', () => {
40-
const contextualPostsOptions = new Set( [
41-
{
42-
value: faker.number.int( 10 ),
43-
label: 'Post One',
44-
},
45-
{
46-
value: faker.number.int( { min: 11, max: 20 } ),
47-
label: 'Post Two',
48-
},
49-
] );
50-
const newState = reducer( state, {
51-
type: 'UPDATE_CONTEXTUAL_ENTITIES_OPTIONS',
52-
contextualEntitiesOptions: contextualPostsOptions,
53-
} );
54-
55-
expect( newState.contextualEntitiesOptions ).toEqual(
56-
contextualPostsOptions
57-
);
58-
} );
59-
6039
it( 'Update the Posts Options', () => {
6140
const postsOptions = new Set( [
6241
{
@@ -120,7 +99,6 @@ describe( 'reducer', () => {
12099
} );
121100

122101
expect( newState.selectedEntitiesOptions ).toEqual( new Set() );
123-
expect( newState.contextualEntitiesOptions ).toEqual( new Set() );
124102
expect( newState.currentEntitiesOptions ).toEqual( new Set() );
125103
} );
126104

@@ -142,7 +120,6 @@ describe( 'reducer', () => {
142120
entitiesOptions,
143121
} );
144122

145-
expect( newState.contextualEntitiesOptions ).toEqual( entitiesOptions );
146123
expect( newState.currentEntitiesOptions ).toEqual( entitiesOptions );
147124
expect( newState.selectedEntitiesOptions ).toEqual( new Set() );
148125
expect( newState.entities ).toEqual( new Set() );

0 commit comments

Comments
 (0)