Skip to content

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

@orther

Description

@orther

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions