timdeschryver / ngrx-immer

Immer wrappers around NgRx methods createReducer, on, and ComponentStore
https://www.npmjs.com/package/ngrx-immer
MIT License
120 stars 7 forks source link

ImmerComponentStore error #1

Closed nartc closed 3 years ago

nartc commented 3 years ago

image Getting this error with ImmerComponentStore as soon as startup.

Also, are we missing the use of immerReducer here? https://github.com/timdeschryver/ngrx-immer/blob/main/src/component-store/index.ts#L26

timdeschryver commented 3 years ago

Hi, thanks for raising the issue.

Do you have a reproduction to share? I tried it (in stackblitz) with the ngrx demo app, and it seems to work here. (https://stackblitz.com/edit/angular-vxzacg?file=src/app/slide-toggle.component.ts)

It doesn't need the immerReducer, because it uses the updater method to update the state. setState is added to ImmerComponentStore to override the typings so it doesn't require you to return the state.

nartc commented 3 years ago

Here's the Stackblitz with the issue: https://stackblitz.com/edit/angular-ivy-immer-component-store-issue?file=src/app/store.ts

timdeschryver commented 3 years ago

Thanks @nartc ! That's weird... when I download the sb locally it seems to build... Anyways, ngrx-immer (v0.0.4) is now build with ng-packagr so the issue should be resolved - at least it seems to be on my end 😀 Feel free to re-open if that's not the case.