## 5.0.0 - April 2021
- Breaking changes (Thinking more in JS way, and less in C++ or Java way): In order to remove recurrent call of
createDispatcher(stateRef, reRenderTrigger)inconst wrappedDispatcher = React.useRef(createDispatcher(stateRef, reRenderTrigger))for Providers components, and sinceuseRefdoes not allow for a creation function ("yet"), the internal implementation for component is changed to class component, avoiding that recurrent call (big fan of hooks but using them wisely).- It's only a breaking change, if you were using
*Provideras a function and not as JSX, e.g.<>{SyncReducerProvider(..)}</>(some rare use case, but valid) instead of<SyncReducerProvider..>..</SyncReducerProvider>. - Major breaking change if when consuming Tagged Providers using
useTaggedAnyState,useTaggedAnyDispatcher,injectTaggedAnyDispatcherorinjectTaggedAnyState.-
useTaggedAnyState,useTaggedAnyDispatcher,injectTaggedAnyDispatcherandinjectTaggedAnyStateare removed (although could be kept, but the performance will be poor compare to usinguseTaggedAnyorinjectTaggedAny).
-
- Also, how
useTaggedAny/injectTaggedAnyis used changed, now it returns agetto obtain the provider value. - When moving to classes, what I named 'method imbuing' was use to avoid prototype chaining (it will increase performance, but it may minimal increase memory consumption if more than 1 StateProvider is used (, but we use
bindin classes "everyday", which is pretty similar)). - Not even 1 test was changed or remove, only new tests were added, i.e. A totally successful refactoring.
- Using classes the internal code complexity was reduce, increasing learnability and maintainability.
- It's only a breaking change, if you were using
- Optional initial state for reducer and mapper.
- Adds new tests.
- Restores fields for consumption in order to be more flexible and avoid array destructuring if desired (avoiding array destructuring may increase performance if polyfill is required) and improves readability for some cases.
- Adds new tests.
- Internally, changes from
context[0]ycontext[1]tocontext.state,context.dispatch, increasing learnability and maintainability.
- Adds
providerfield to object/tuple accessed when consuming, with the id of the provider. - Adds
tagfield field to object/tuple accessed when consuming tagged. - Checks if the state is the same before computing new internal state, to avoid re-renderings.
- Adds new tests.
- Adds
shouldComponentUpdateto avoid any re-render when State Provider props changes, i.e. ignore props changed for render, not for processing, improving performance. - Internal implementation for tagging is now made with 1 Map instead of 2, improving performance.
- Improves HOC performance.
- Seals the reducer/mappers tuple, i.e. cannot be directly changed when consuming or extend, in order to promote best practices when developing and avoiding side-effects bugs.
- Secures internal map for Tagged State providers, to avoid changing when consuming.
- Updates async tests to run faster and avoid failures in ci.
- Renames files:
-
useReducer.jstouseAny.js. -
useReducerDispatcher.jstouseAnyDispatcher.js. -
useReducerState.jstouseAnyState.js. -
useTaggedReducer.jstouseTaggedAny.js. -
useTaggedReducerDispatcher.jstouseTaggedAnyDispatcher.js. -
useTaggedReducerState.jstouseTaggedAnyState.js. -
ReducerProvider.jstoimbueTaggedStateProvider.js-
MapperProvider.jsand gone.
-
-
TaggedReducerProvider.jstoimbueTaggedStateProvider.js.
-
- Updates Documentation files.
- Adds documentation for Function as state.
- Adds documentation for Provider props changes.
- Adds documentation for Exceptions.
- Renames
blending-*.mdtotagged-*.md.