All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
Nothing!
- React v18 has been added to
peerDependencies
(alongside v16 and v17). - React Redux v8 has been added to
peerDependencies
(alongside v6 and v7).
- (thunk): Typings have been updated.
- Module augmentation overloading
Dispatch
has been added. - Type parameters have been reordered and renamed to resemble
redux-thunk
more closely. getNamespacedState()
is now a generic function instead of having a bound type.
- Module augmentation overloading
- (middleware): Typings have been updated.
getNamespacedState()
is now a generic function instead of having a bound type.
- (injectors):
setEntries
no longer creates shallow copies of thestore.entries
object, fixing server-side rendering warnings when multiple injector enhancers are applied to a store.
- (injectors-react): Use
typeof window === 'undefined'
to detect server-side rendering environments.
- (injectors-react): Add
isNamespaced
to injectoruseEffect
dependencies.
- TypeScript.
- (thunk): A named export of
thunkMiddleware
has been added in addition to the default one.
- (utils): Miscellaneous breaking changes which shouldn't affect the end user.
- (utils-react): Miscellaneous breaking changes which shouldn't affect the end user.
- Dependencies in all packages have been cleaned up.
@babel/runtime
was added as a dependency to all packages.
- Feature fallbacks are now more consistent. This should help with namespace resolution in some use cases.
- (redux-syringe): Update
package.json#main,module,unpkg
fields.
- (redux-syringe): Added reexport of
thunkMiddleware
.
- (utils):
prefixedValueMirror
has been removed. The@redux-syringe/actions
package thus no longer depends on any other Redux Syringe packages.
- All non-preset packages have been renamed from
@redux-tools/<package>
to@redux-syringe/<package>
. - The
@redux-tools/react
preset package was renamed toredux-syringe
.
- (redux-syringe): Add missing
preventNamespace
reexport.
- (actions): Added
makePayloadMetaActionCreator
. - (actions): Added invariant to action creator factories which checks that the type is a non-empty string.
- (actions): Added invariant to
makePayloadActionCreator
andmakeEmptyActionCreator
for checking the correct number of arguments. - (injectors-react): Added
isNamespaced
prop for all injector hooks and decorators. Use this option to indicate that an injectable must always be injected under a namespace. - (injectors-react): It is now possible to reliably inject functions, arrays, and complex objects.
- (middleware): Added
composeMiddleware
. - (namespaces): Added
preventNamespace
, which always overwrites the original namespace with a "global" namespace. - (namespaces): Added
getStateByAction
andgetStateByNamespace
which always use the default feature. - (namespaces-react): New package! Existing logic from various packages has been moved here (
useNamespace
,NamespaceProvider
andnamespacedConnect
). - (namespaces-react):
withNamespaceProvider
can now be used to create complex multi-instance components more easily. - (namespaces-react): Added
useNamespacedDispatch
anduseNamespacedSelector
hooks. - (reducers):
makeReducer
now supports arrays of strings and predicates. - (reducers): It is now possible to inject deep reducer structures, allowing for view-based state management.
- (actions):
makeConstantActionCreator
has been renamed tomakeEmptyActionCreator
(original export still present). - (actions): Changed signatures of
makePayloadActionCreator
andmakeEmptyActionCreator
. - (actions):
makeSimpleActionCreator
has been renamed tomakePayloadActionCreator
(original export still present). - (actions):
makeActionCreator
has been renamed toconfigureActionCreator
. - (actions):
makeReducer
has been moved to the@redux-tools/reducers
package. - (injectors-react):
Provider
has been renamed toNamespaceProvider
. - (injectors-react): It is no longer necessary to pass
isGlobal: true
when not using the namespacing mechanism. - (namespaces): Renamed
getStateByAction
andgetStateByNamespace
togetStateByFeatureAndAction
andgetStateByFeatureAndNamespace
. - (namespaces-react):
useNamespace
no longer falls back toDEFAULT_FEATURE
if no namespace could be resolved. - (react): The unpkg bundle now includes all dependencies except for React, Redux, and React Redux.
- (reducers):
makeReducer
now uses the default reducer for error actions if the error reducer is missing. - (reducers):
getStateByAction
andgetStateByNamespace
have been moved to the@redux-tools/namespaces
package.
- (injectors-react): Static namespace and feature in decorators is no longer passed down to inner components.
- (namespaces-react): Static namespace and feature in
namespacedConnect
is no longer passed down to inner components.
- The unpkg bundle is no longer created for non-preset packages.
Oops.
ramda
andramda-extension
dependency versions are now less strict.- All transitive peer dependencies are now listed in the appropriate packages.
- (reducers): Reducer state is no longer cleaned up if an equal entry is still injected.
- redux-tools.js.org β€οΈ
- (react): New package!
@redux-tools/react
reexports everything necessary to get started with Redux Tools in a React application. - (reducers): Enhancer now supports initial reducers.
- Appropriate dependencies added to
useEffect
in injection hooks. - (middleware): Injected middleware are now properly called in the order of injection.
- (reducers): Existing state keys are now preserved to allow preloading of global state.
- (reducers): Clean up reducer state after ejection.
- (namespaces): Added
attachNamespace
, which always overwrites the original namespace. - (middleware): Middleware now automatically sets the namespace of each dispatched action.
- (middleware):
getNamespacedState
andnamespace
are now available in the first argument in all injected middleware.
- (namespaces): Renamed
attachNamespace
todefaultNamespace
.
- (middleware): Injected middleware are now properly called in the order of injection.
- (middleware): Middleware no longer automatically sets the namespace of each action via
next()
.
- (namespaces): Unnecessary utility functions (
attachFeature
andgetFeatureByAction
).
- Hook-based API. You can now use
useMiddleware
,useEpics
anduseReducers
with a caveat: don't dispatch any actions until the injectables are injected (based on hook return value). Hooks are also used under the hood for better structure and performance. - Loads of new useful warnings when injecting and ejecting.
- You can now define namespaces and features statically (or using props) in
withMiddleware
,withEpics
andwithReducers
. - You can now inject functions in addition to objects. Note that a function (reducer, middleware or epic) will only be initialized once per namespace/feature.
- Support for Redux Thunk! Just use our clone instead of the official implementation to enable automatic namespace passthrough via thunks.
- (reducers): Support for features! This allows using Redux Tools with a feature-based state structure, similar to when using e.g. Redux Form.
- (reducers-react): Warn when using withReducers with global: false and no namespace.
- The injection API was changed from
(injectables, namespace, version)
to(injectables, { namespace, feature })
. - All the
enhancer
exports were changed tomakeEnhancer
because of ambiguity in the injectable middleware enhancer. - Loads of internal refactoring under the hood to reduce duplicate code and improve tests maintainability.
global
andpersist
options in decorators were renamed toisGlobal
andisPersistent
.- (middleware): Injectable middleware enhancer now has an
injectedMiddleware
property, which you must use to signify the execution point of the middleware.
- (middleware): Correctly skip duplicate middleware.
- (reducers): The reducer passed to
createStore()
as the first argument is now composed with the injected reducers. - Support for injectable middleware! See the
middleware
andmiddleware-react
packages.
- (injectors-react): Performance optimizations in
<InjectorContext.Consumer />
.
- Documentation, including the README.md and FAQ.md files.
- (actions):
makeActionTypes
as an export ofprefixedValueMirror
from the utils package.
- (utils):
getDisplayName
function now handles strings. - (injectors-react): Now compatible with react-redux v6.
- This changelog!
- (epics):
streamCreators
property has been renamed tostreamCreator
and now accepts a function instead of an array. - (injectors-react):
<Provider />
is now a separate component which acceptsstore
,withNamespace
andnamespace
props directly. It also allows for seamless nesting (no need to always provide all properties).
- The injection mechanism now supports React async rendering.
- (reducers): Reducers now filter actions by namespace properly.