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

const reducers #73

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

2ZeroSix
Copy link

Allow to build entire reducers tree as const object.

  • add CombinedReducer class to easily combine reducers in const context
  • mark TypedReducer constructor as const
  • add UntypedReducer as shorthand for TypedReducer<State, dynamic>.
  • add related tests
  • add related docs in code and doc/combine_reducers.dart

@codecov-io
Copy link

codecov-io commented Nov 14, 2020

Codecov Report

Merging #73 (4da85ce) into master (8872c0b) will decrease coverage by 3.21%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
- Coverage   92.10%   88.88%   -3.22%     
==========================================
  Files           2        2              
  Lines          38       45       +7     
==========================================
+ Hits           35       40       +5     
- Misses          3        5       +2     
Impacted Files Coverage Δ
lib/src/utils.dart 90.00% <75.00%> (-10.00%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8872c0b...4da85ce. Read the comment docs.

@hacker1024
Copy link

I think similar changes can also be made to middleware.

@hacker1024
Copy link

This PR has been open for a while, does anyone have anything to say?

@brianegan
Copy link
Collaborator

brianegan commented Mar 23, 2021

Thanks! Sorry -- only have a little bit of time for open source these days and missed this one. Could you please describe in a
bit more detail the problem you want to solve with this PR? Sure, const is nice, but this PR seems to introduce some complexity in order to support const Reducers. For example, combineReducers and CombineReducers looks kinda rough.

Do const reducers bring enough of an advantage to outweigh the larger API surface?

In my view, Reducer classes are instantiated once, when the app is first created. They aren't like Widgets which can re-instantiated over and over, where a const constructor really shines. What do you think?

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.

None yet

4 participants