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

Resource Helper - Add new selector to return status object #25

Open
orther opened this issue May 4, 2018 · 0 comments
Open

Resource Helper - Add new selector to return status object #25

orther opened this issue May 4, 2018 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects

Comments

@orther
Copy link
Member

orther commented May 4, 2018

Current Usage

Currently the resource helpers return a separate selector for each status of a resource request. To minimize the number of passed in props a single status object prop can be created like so:

const {selectors} = resourceListRead('inspector', 'inspector');

const mapStateToProps = state => ({
  status: {
    pending: selectors.pending(state),
    rejected: selectors.rejected(state),
    fulfilled: selectors.fulfilled(state),
    done: selectors.done(state),
  },
});

Desired Usage

Add a selector statusObj that's returned by the resource helpers that provides the status object:

const {selectors} = resourceListRead('inspector', 'inspector');

const mapStateToProps = state => ({
  status: selectors.statusObj(state),
});
@orther orther added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels May 4, 2018
@orther orther added this to To do in Work Log May 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
Work Log
  
To do
Development

No branches or pull requests

1 participant