Release Notes
What changed in the notable releases of @angular-redux2/store. The current line is v6.0.x.
v6.0.1
- Fixed: An application that installed 6.0.0 failed to build with
Could not resolve "@services/ng-redux.service"and similar errors. The published bundle imported the library's own files through internal path aliases instead of including them, so@angular-redux2/storeand@angular-redux2/store/mocksare self-contained again. - Fixed: The published types resolve again. They imported the same internal aliases, so
NgReduxlost its members,selectandselect$were reported as missing, and selector parameters were typed as implicitany. - Migration: Update from 6.0.0 to 6.0.1. The API is unchanged, so no application code changes.
v6.0.0
Version 6 rebuilds the store on Angular signals. The state is a signal, every selection is a computed, and the decorators move to a separate package. See Migrating from 5.x for the reasons and a side-by-side guide. Design decisions explains what was removed and what was left out, and Benchmarks compares it with 5.0.2.
ts
export class Counter {
readonly count = injectSelect((state: AppState) => state.counter);
}- Added:
NgRedux.stateholds the whole state as a signal, andselectreturns acomputedover it. Neither needs a subscription, an injection context, or atsconfig.jsonsetting. - Added:
select$returns an observable that emits every change synchronously, for RxJS pipelines. - Added:
injectSelectandinjectSubstorefor components. A sub-store path can be a function, so a sub-store follows a signal input. - Added:
createSlicebuilds a reducer and typed action creators from one handler per action, andcreateActionbuilds a creator for a single type. Both keep a falsy payload. Slice handlers get draft state, so they can mutate (#2, #10). - Added:
provideNgReduxcreates the store in one call. Its options are the reducer, the initial state, Redux middleware, enhancers, Redux DevTools,freeze, andtransferState. - Added:
provideNgReduxFeatureadds a slice for a lazy route. - Added:
freezeReducerdeep-freezes every state that a reducer returns. - Added:
destroyon a sub-store, so the store forgets the reducer of sub-stores that are gone.injectSubstorecalls it when its component is destroyed. - Added:
provideMockNgReduxand a state-basedMockNgRedux: the test sets the state and reads the recorded dispatches. - Changed: Faster across the board. A dispatch runs a plain reducer and sets one signal, and a selector runs only when something reads it. Against 5.0.2, 1,000 dispatches take 0.56 ms instead of 287 ms, and 1,000 selections over 100 dispatches take 1.1 to 4 ms instead of 54 ms. See Benchmarks.
- Changed: Signals are built in. A selection works with
computed,effect,linkedSignal, signal inputs, OnPush, and zoneless change detection. - Changed:
selectreturns aSignalinstead of anObservable.select$is the observable form, and the comparator argument is now theequaloption. - Changed: The store is created ready, the first time something injects it, so no initializer has to run first.
- Changed: A selector is always a function. String keys and path arrays could not be typed.
- Changed: Draft state is opt-in through
draftand slices. A plain reducer is a plain Redux reducer again. Setting a value back to what it was now keeps the previous state. - Changed: A sub-store action reaches only its own reducer, and carries a serializable route, so Redux DevTools records and replays it.
- Changed: Built and tested against Angular 22, TypeScript 6, RxJS 7.8, and Redux 5. The peer ranges are
@angular/core20 and later,rxjs^7.5.0, andredux^5.0.0. - Fixed: A plain object from another realm, such as an iframe or a jsdom test, counts as plain, so
draftandfreezeno longer skip it. - Fixed: A
nullvalue in the state no longer throws when a reducer reads it (#34, #29), and aDate,Map,Set, or class instance reaches a draft reducer as it is (#31). - Fixed: A reducer that keeps a draft object in a new place, such as an undo history, stores the plain object and never the draft (#24).
- Fixed:
select$emits once on subscribe and stays quiet until its value changes (#3). - Fixed:
MockNgReduxserves the state that the test sets, so a selector stub no longer depends on the text of its function, which coverage tools rewrite (#9). - Fixed: A store works with RxJS
from(store)without aSymbol.observablepolyfill, see Interop observable. - Fixed: A lazy feature starts from its key in the initial state, such as state that
transferStatebrought from the server, instead of the default of its reducer. - Fixed:
MockNgRedux.setStateandpatchStateset the key of a feature reducer. - Fixed: A thunk dispatched through a sub-store reaches the thunk middleware unchanged.
- Removed:
@Select,@Select$,@Dispatch, and@Substore. They live on in@angular-redux2/decorators, see Keep the decorators. - Removed:
AbstractReducer,@Action, andReducerActionsType, replaced bycreateSlice. - Removed:
NgReduxModule,configureStore,provideStore,replaceStore, the staticNgRedux.store,DevToolsExtension, and reducer middleware.NgReduxkeeps the underlying Redux store asredux. - Removed:
subscribe, replaced byselect$, aneffect, orstore.redux.subscribe. - Removed:
replaceReducer, replaced byaddReducerandprovideNgReduxFeature. - Removed:
configureSubStore, replaced bysubstore. - Removed:
MockNgReduxModule,getSelectorStub, andgetSubStore, replaced byprovideMockNgRedux. - Migration: Follow Migrating from 5.x. To move one component at a time, add
@angular-redux2/decoratorsand change its imports first. - Migration: An application on Angular 19 or earlier stays on
v5.0.x. - Thanks: Feature reducers, state freezing, state transfer, and the
nullandDatefixes came from reviewing theangular-redux3/storefork. Design decisions lists what else it adds and why version 6 leaves it out.
Earlier releases
- v5.0.x - the rewrite around
AbstractStore: class reducers, draft state, reducer middleware, and themocksentry point (archived docs). - v4.0.x - the first
@angular-redux2/storeline, with tab sync and thetestingentry point (archived docs).
