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

Example: App fails at runtime due to existing type check in createReducer #1837

Closed
brandonroberts opened this issue May 8, 2019 · 3 comments · Fixed by #1841
Closed

Example: App fails at runtime due to existing type check in createReducer #1837

brandonroberts opened this issue May 8, 2019 · 3 comments · Fixed by #1841

Comments

@brandonroberts
Copy link
Member

brandonroberts commented May 8, 2019

Minimal reproduction of the bug/regression with instructions:

Expected behavior:

Found this issue when trying to re-enable e2e tests for the example app.

The createReducer function checks to make sure duplicate action creators aren't being used in the same on method in development mode. This causes the example app to fail at runtime.

Uncaught Error: Cannot enable prod mode after platform setup.
    at ni (core.js:6059)
    at Module.IVes (main.ts:9)
    at i (bootstrap:83)
    at Object.0 (_string-ws.js:1)
    at i (bootstrap:83)
    at t (bootstrap:45)
    at Array.r [as push] (bootstrap:32)
    at main.190ba58f5a8a435f2870.js:1

https://github.com/ngrx/platform/blob/master/modules/store/src/reducer_creator.ts#L188

When isDevMode is called, it locks up the run mode https://github.com/angular/angular/blob/909557d5f822a84821f07cc27680307cb76ca9d5/packages/core/src/util/is_dev_mode.ts

@timdeschryver
Copy link
Member

🤦‍♂️ This is not the first time I get burned by it, and I keep forgetting it so it won't be the last time... I think we can't have this check available due to this.
The only way I see is to have this check in the reducer and not in the create function and we would need to change the Map<string, ActionReducer<S>> implementation.

Is this something we want, or should we remove the check?

@brandonroberts
Copy link
Member Author

I don't think its worth having on every reducer call, so I'd lean towards removing it.

@jotatoledo
Copy link

jotatoledo commented Nov 13, 2020

Im seeings this issue when trying to call enableProdMode. From all the dependecies in my project, this is the only one that makes use of isDevMode. Ill try to confirm that ngrx its causing the issue and create a new ticket if thats the case

@ngrx ngrx deleted a comment Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants