Skip to content

Commit 1919519

Browse files
authored
Remove Selectorator (#191)
* Remove Selectorator references * Update createSelector docs to drop Selectorator * Remove Selectorator and add explicit Reselect dependency
1 parent 34f53f0 commit 1919519

File tree

6 files changed

+12
-87
lines changed

6 files changed

+12
-87
lines changed

docs/api/createSelector.md

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,14 @@ hide_title: true
77

88
# `createSelector`
99

10-
The `createSelector` utility from the [`selectorator` library](https://github.com/planttheidea/selectorator), re-exported for ease of use. It acts as a superset of the standard `createSelector` function from [Reselect](https://github.com/reactjs/reselect). The primary improvements are the ability to define "input selectors" using string keypaths, or return an object result based on an object of keypaths. It also accepts an object of customization options for more specific use cases.
10+
The `createSelector` utility from the [Reselect library](https://github.com/reduxjs/reselect), re-exported for ease of use.
1111

12-
For more specifics, see the [`selectorator` usage documentation](https://github.com/planttheidea/selectorator#usage).
12+
For more details on using `createSelector`, see:
1313

14-
```ts
15-
function createSelector(
16-
// Can either be:
17-
// - An array containing selector functions, string keypaths, and argument objects
18-
// - An object whose keys are selector functions and string keypaths
19-
paths: Array<Function | string | Object> | Object<string, string | Function>
20-
)
21-
```
14+
- The [Reselect API documentation](https://github.com/reduxjs/reselect)
15+
- [Idiomatic Redux: Using Reselect Selectors for Encapsulation and Performance](https://blog.isquaredsoftware.com/2017/12/idiomatic-redux-using-reselect-selectors/)
16+
- [React/Redux Links: Reducers and Selectors](https://github.com/markerikson/react-redux-links/blob/master/redux-reducers-selectors.md)
2217

23-
Example usage:
24-
25-
```js
26-
// Define input selector using a string keypath
27-
const getSubtotal = createSelector(
28-
['shop.items'],
29-
items => {
30-
// return value here
31-
}
32-
)
33-
34-
// Define input selectors as a mix of other selectors and string keypaths
35-
const getTax = createSelector(
36-
[getSubtotal, 'shop.taxPercent'],
37-
(subtotal, taxPercent) => {
38-
// return value here
39-
}
40-
)
41-
42-
// Define input selector using a custom argument index to access a prop
43-
const getTabContent = createSelector(
44-
[{ path: 'tabIndex', argIndex: 1 }],
45-
tabIndex => {
46-
// return value here
47-
}
48-
)
49-
50-
const getContents = createSelector({ foo: 'foo', bar: 'nested.bar' })
51-
// Returns an object like: {foo, bar}
52-
```
18+
> **Note**: Prior to v0.7, RSK re-exported `createSelector` from [`selectorator`](https://github.com/planttheidea/selectorator), which
19+
> allowed using string keypaths as input selectors. This was removed, as it ultimately did not provide enough benefits, and
20+
> the string keypaths made static typing for selectors difficult.

package-lock.json

Lines changed: 0 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"redux-devtools-extension": "^2.13.8",
5858
"redux-immutable-state-invariant": "^2.1.0",
5959
"redux-thunk": "^2.2.0",
60-
"selectorator": "^4.0.3"
60+
"reselect": "^4.0.0"
6161
},
6262
"jest": {
6363
"testEnvironment": "node",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export { combineReducers, compose } from 'redux'
22
export { default as createNextState } from 'immer'
3-
export { default as createSelector } from 'selectorator'
3+
export { createSelector } from 'reselect'
44

55
export * from './configureStore'
66
export * from './createAction'

src/typings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export {
1010
compose
1111
} from 'redux'
1212
export { default as createNextState } from 'immer'
13-
export { default as createSelector } from 'selectorator'
13+
export { default as createSelector } from 'reselect'
1414

1515
export * from '.'

type-tests/files/createSlice.typetest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function expectType<T>(t: T) {
125125
{
126126
const counter = createSlice({
127127
slice: 'test',
128-
initialState: { counter: 0, concat: "" },
128+
initialState: { counter: 0, concat: '' },
129129
reducers: {
130130
incrementByStrLen: {
131131
reducer: (state, action: PayloadAction<number>) => {

0 commit comments

Comments
 (0)