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

feat(store): make reducers accessible from ReducerManager #3064

Merged
merged 3 commits into from
Jul 6, 2021

Conversation

GregOnNet
Copy link
Contributor

@GregOnNet GregOnNet commented Jul 4, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

The ActionReducerMap of ReduceManager is internal.
It is hard to enhance ActionReducerMap dynamically.

Closes #3049

What is the new behavior?

The ActionReducerMap of ReduceManager can be accessed via getter (READ-ONLY).
This allows to get to know which features are registered in the store, at run-time.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@ngrxbot
Copy link
Collaborator

ngrxbot commented Jul 4, 2021

Preview docs changes for 7636216 at https://previews.ngrx.io/pr3064-76362166/

@@ -26,6 +25,10 @@ export const UPDATE = '@ngrx/store/update-reducers' as const;
export class ReducerManager
extends BehaviorSubject<ActionReducer<any, any>>
implements OnDestroy {
get reducerSnapshot(): ActionReducerMap<any, any> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not use snapshot here

Suggested change
get reducerSnapshot(): ActionReducerMap<any, any> {
get currentReducers(): ActionReducerMap<any, any> {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion.
I will apply it.

I came up with snapshot, since Angular uses this term, too (see ActivatedRoute) and I wanted to reuse already known terms.

But I am fine with currentReducers, too.

@brandonroberts brandonroberts changed the title feature(ReducerManager): Make reducers more accessible feat(store): make reducers accessible from ReducerManager Jul 5, 2021
@brandonroberts brandonroberts added the Needs Cleanup Review changes needed label Jul 5, 2021
@GregOnNet GregOnNet requested a review from brandonroberts July 6, 2021 06:16
@brandonroberts brandonroberts removed the Needs Cleanup Review changes needed label Jul 6, 2021
@brandonroberts brandonroberts merged commit bf2bd1a into ngrx:master Jul 6, 2021
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

Successfully merging this pull request may close these issues.

Make ReducerManager more extensible
4 participants