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

Standardize the resource loading status names between helper selectors and ResourceLoader components #64

Open
orther opened this issue Feb 6, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@orther
Copy link
Member

orther commented Feb 6, 2019

Feature Request

Is your feature request related to a problem? Please describe.
The status selectors from the URM resource helper are named differently than the status properties returned from the ResourceLoader components.

The URM helper selectors are using the redux-saga-thunk naming (i.e pending, rejected, fulfilled and done) for status selectors. These match the naming convention of the underlying library used redux-saga-thunk. Here is example code of the status selectors returned from a resource helper.

// NOTE the selector names
const { pending, rejected, fulfilled, done } = resourceListRead('demo').selectors;

The ResourceLoader components return a status object with properties initial, loading, error, and success`. Here is example code showing the status object returned to the render prop a ResourceLoader component:

const DemoListLoader = () => (
  <ResourceListLoader resource="demo" autoLoad>
    // NOTE the status names names
    {({status: { loading, error, success, done }) => (
      <div>Load status example</div>
    )}
  </ResourceListLoader>
);

Describe the solution you'd like
I prefer the naming used in the ResourceLoader components so I suggest we update the resource helpers to return selectors renamed to match. The selectors would be renamed:

Current Renamed
pending loading
rejected error
fulfilled success
done done
// suggested updated selector names
const { loading, error, success, done } = resourceListRead('demo').selectors;

Describe alternatives you've considered
Alternatively we could rename the ResourceLoader components status object. I prefer the ResourceLoader status names to the redux-saga-thunk names. They are more clear imo.

@orther orther added the enhancement New feature or request label Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants