maxime1992 / angular-ngrx-starter

An opiniated Angular setup based on @angular/cli to kickstart an ngrx project
https://maxime1992.github.io/angular-ngrx-starter/
65 stars 8 forks source link

chore: upgrade to ngrx v4 #12

Closed maxime1992 closed 6 years ago

maxime1992 commented 6 years ago

There are compatibility issues with ngrx v4 and AOT.

While those 2 are not playing well together, this PR should be on hold.

https://github.com/ngrx/platform/issues/189

brandonroberts commented 6 years ago

Your enableBatching meta-reducer needs to be wrapped in an exported function for AOT

// ------------------------------------------------------------------------------
export function batcher(reducer) {
  return enableBatching(reducer);
}
// if environment is != from production
// use storeFreeze to avoid state mutation
const metaReducersDev = [storeFreeze, batcher];

// enableBatching allows us to dispatch multiple actions
// without letting the subscribers being warned between the actions
// only at the end : https://github.com/tshelburne/redux-batched-actions
// can be very handy when normalizing HTTP response
const metaReducersProd = [batcher];

export const metaReducers = environment.production
  ? metaReducersProd
  : metaReducersDev;
maxime1992 commented 6 years ago

Thanks a lot for helping on this one @brandonroberts! I'll take a look ASAP :smile:

maxime1992 commented 6 years ago

@brandonroberts just updated to latest versions of Effects and Store, didn't touched anything more and it's now working well :tada: :smile:

brandonroberts commented 6 years ago

👍