ahoym / redesert

Work in Progress - Opinionated HOFs for auto-generating REST API consuming redux logic
MIT License
3 stars 1 forks source link

Make selector factories #10

Closed ahoym closed 6 years ago

ahoym commented 6 years ago

Context

If we have a consistent namespace within a resource where we store data entities (entitiesPath), and we consistently know where properties are going to be set, updated, or removed, then we can dynamically create selectors that traverse the structures that our reducers consistently output.

As an example, we actually use the makeResourceReducer function in our tests, use the same resource and entitiesPath for both reducer and selector factories, and are able to use the selectors on the output state from the fooReducer.

This is valuable as selectors traverse the exact states that reducers output, so by that relationship they have to be coupled. This allows data providers to only interface with selectors, which completely isolates the view from needing to know what the structure of the store looks like.

Note for the future, this can probably be its own package if consumers do not want to use selectors.

Additional Changes

Tasks

codeclimate[bot] commented 6 years ago

Code Climate has analyzed commit 6951d6cf and detected 3 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 3

The test coverage on the diff in this pull request is 96.9% (50% is the threshold).

This pull request will bring the total coverage in the repository to 97.4% (0.1% change).

View more on Code Climate.

ahoym commented 6 years ago

okay codeclimate, that's enough now