Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngrx store freeze error #30

Closed
sbkpilot1 opened this issue Mar 7, 2018 · 3 comments
Closed

ngrx store freeze error #30

sbkpilot1 opened this issue Mar 7, 2018 · 3 comments

Comments

@sbkpilot1
Copy link

I am trying to implement ngrx-store-freeze@0.2.1 to our project and i'm getting this error on app startup:

ERROR Error: Uncaught (in promise): TypeError: Cannot add property _resolvedData, object is not extensible
TypeError: Cannot add property _resolvedData, object is not extensible
    at MapSubscriber.eval [as project] (router.js:3909)
    at MapSubscriber._next (map.js:79)
    at MapSubscriber.Subscriber.next (Subscriber.js:92)
    at ScalarObservable._subscribe (ScalarObservable.js:51)
    at ScalarObservable.Observable._trySubscribe (Observable.js:172)
    at ScalarObservable.Observable.subscribe (Observable.js:160)
    at MapOperator.call (map.js:57)

Any ideas? My store is configured like so:

StoreModule.forRoot(<any>{app: appReducer}, { metaReducers: metaReducers, initialState: initialState })

@kanafghan
Copy link

@sbkpilot1 are you using @ngrx/router-store and have you implemented your own custom serializer for the RouterStateSnapshot? (see https://github.com/brandonroberts/ngrx-store-freeze/blob/master/docs/docs.md#additional-documentation)

@envil
Copy link

envil commented Mar 16, 2018

You have to provide RouterStateSerializer:

@NgModule({
  ...
  providers: [
    { provide: RouterStateSerializer, useClass: CustomRouterStateSerializer}
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

You can find one implementation here: https://github.com/ngrx/platform/blob/master/example-app/app/shared/utils.ts

@ghost
Copy link

ghost commented Oct 31, 2018

For anyone using @envil's answer, the link has moved with more documentation: https://github.com/ngrx/platform/blob/master/docs/router-store/api.md#custom-router-state-serializer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants