Skip to content

Nested reducers aren't working anymore with V4Β #306

@Braincompiler

Description

@Braincompiler

I'm submitting a...


[x] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

What is the current behavior?

I have to migrate a huge codebase using ngrx@v2 to ngrx@v4 (Cause we need the better support for lazy-loaded modules). In v2 we were able to use combineReducers even with AOT but after migrating to v4 there will be either a compile error according to resolving symbol values statically or if I remove the combineReducers calls the reducers with nested reducers are missing on the state.

The compile error:

ERROR in Error encountered resolving symbol values statically. Calling function 'combineReducers', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol reducers in /Users/XXX/Projects/ngrx-bugs/ngrx-nested-reducers/src/app/reducers.ts, resolving symbol AppModule in /Users/XXX/Projects/ngrx-bugs/ngrx-nested-reducers/src/app/app.module.ts, resolving symbol AppModule in /Users/XXX/Projects/ngrx-bugs/ngrx-nested-reducers/src/app/app.module.ts, resolving symbol AppModule in /Users/XXX/Projects/ngrx-bugs/ngrx-nested-reducers/src/app/app.module.ts

If I use npm start (ng serve) the first round of compiling fails with the error above, if I change a file and trigger the watcher all the subsequent compilations will be successful and the reducers work as expected.

Expected behavior:

I want to use the current (nested) reducers (up to 5 levels deep in some cases). Of course I could flatten all the reducers but this would be a lot of refactoring I hope to avoid.

Minimal reproduction of the problem with instructions:

I created a small app which reproduces the behavior: https://github.com/Braincompiler/ngrx-nested-reducers (If you remove the combineReducers calls the state is empty).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions