Skip to content

Implement react redux registry#71

Merged
spasovski merged 2 commits intodeephaven:mainfrom
mofojed:redux-registry
Jun 15, 2021
Merged

Implement react redux registry#71
spasovski merged 2 commits intodeephaven:mainfrom
mofojed:redux-registry

Conversation

@mofojed
Copy link
Member

@mofojed mofojed commented Jun 14, 2021

Allows modular code to register reducers

Blog post: http://nicolasgallagher.com/redux-modules-and-code-splitting/

@mofojed mofojed added this to the June 2021 milestone Jun 14, 2021
@mofojed mofojed requested a review from spasovski June 14, 2021 20:02
@mofojed mofojed self-assigned this Jun 14, 2021

register(name: string, reducer: Reducer): void {
this.reducers = { ...this.reducers, [name]: reducer };
this.listener?.(this.reducers);
Copy link
Contributor

Choose a reason for hiding this comment

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

Haven't seen this in a function call before - freaky!

Copy link
Contributor

@spasovski spasovski left a comment

Choose a reason for hiding this comment

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

Looks good though I am certainly not familiar with Nicolas' approach of a reducer registry. In ether case I am glad this works.

@spasovski spasovski merged commit 0bbabf7 into deephaven:main Jun 15, 2021
mofojed added a commit that referenced this pull request Jun 24, 2021
Related to #71 . When the registry was added, it was first creating the store with no reducers, which caused this error to be printed out. Now, add reducers to the registry before creating the store to avoid the error.

Note reducers can still be added to the registry after that fact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants