Skip to content

v0.7.0

Compare
Choose a tag to compare
@markerikson markerikson released this 08 Sep 23:12
· 3571 commits to master since this release

This release introduces some noticeable breaking changes as we begin working our way towards 1.0.

Breaking Changes

Removal of Selectorator

RSK previously exported the createSelector function from https://github.com/planttheidea/selectorator . Selectorator wraps around Reselect, and the main selling point was that its createSelector wrapper accepted string keypath "input selectors".

However, this capability made usage with TypeScript almost useless, as the string keypaths couldn't be translated into the actual types for the values that were being extracted. Ultimately, there wasn't enough real benefit for keeping this around, and so we are removing Selectorator.

We now simply export createSelector directly from https://github.com/reduxjs/reselect instead.

Migration

Replace any string keypath usages with actual selector functions:

// before
const selectAB = createSelector(
  ["a", "b"],
  (a, b) => a + b
);

// after
const selectA = state => state.a;
const selectB = state => state.b;

const selectAB = createSelector(
    [selectA, selectB],
    (a, b) => a + b
);

Removal of "slice selectors"

createSlice tried to generate a "slice selector" function based on the provided slice name. This was basically useless, because there was no guarantee that the reducer function was being combined under that name. The dynamic name of the generated function also made it hard to use.

Migration

Remove any uses of slice.selectors (such as slice.selectors.getTodos). If necessary, replace them with separate hand-written calls to createSelector instead.

Other Changes

Customization of Default Middleware

The default middleware array generated by getDefaultMiddleware() has so far been a black box. If you needed to customize one of the middleware, or leave one out, you were forced to hand-initialize the middleware yourself.

getDefaultMiddleware now accepts an options object that allows selectively disabling specific middleware, as well as passing options to each of the middleware (such as redux-thunk's extraArgument option).

New Tutorials!

We've added a set of new tutorial pages that walk you through how to use RSK:

  • Basic Tutorial: introduces the RSK APIs in a vanilla JS page
  • Intermediate Tutorial: shows how to use RSK in a CRA app, by converting the standard Redux "todos" example to use RSK
  • Advanced Tutorial: shows how to use RSK with TypeScript, thunks for async and data fetching, and React-Redux hooks, by converting a plain React app to use RSK

Changelog

v0.6.3...v0.7.0