Redux Resource XHR
Redux Resource XHR is an action creator that simplifies CRUD operations.
Installation
To install the latest version:
npm install --save redux-resource-xhr
Documentation
View the documentation at redux-resource.js.org ⇗.
Action creators for Redux Resource using the xhr library
Redux Resource XHR is an action creator that simplifies CRUD operations.
To install the latest version:
npm install --save redux-resource-xhr
View the documentation at redux-resource.js.org ⇗.
Improvements
New Features
getResources
now supports a third argument, options
. Pass { byId: true }
to receive the resources
as an object rather than an array.New Features
includedResources
plugin now supports update requests in addition to create and read requests.Bug Fixes
instanceof Array
calls have been replaced with Array.isArray
to improve support for multiple global
environments.Bug Fixes
DELETE_RESOURCES
action type could log an invalid warning message
to the console in certain situations.New Features
includedResources
plugin now supports create requests in addition to read requests.Bug Fixes
Bug Fixes
actionTypes
export has been fixed. It was not exporting UPDATE_RESOURCES
nor DELETE_RESOURCES
.Breaking Changes
The NULL
request status has been renamed to IDLE
. The request action types (such as READ_RESOURCES_NULL
) have
been updated to reflect this new name.
As a consequence of the above change, getStatus
will now return an object with an idle
key rather than a null
key.
The deprecated getResources()
signature that accepted three arguments has been removed.
Omitting a filter
when calling getResources
now returns all of the resources in the slice.
Four action types have been reserved for a future minor release of Redux Resource: REQUEST_IDLE
, REQUEST_PENDING
,
REQUEST_SUCCEEDED
, and REQUEST_FAILED
. Using these action types will cause a warning to be logged, and will
conflict with an upcoming update to the library.
New Features
The resourceType
is now stored on the resource slice.
There are two new action types for directly modifying resource data independent from requests: UPDATE_RESOURCES
and DELETE_RESOURCES
.
Deprecations
resourceName
property on actions. Use resourceType
instead.Breaking Changes
The library now sets HTTP status codes onto Request Objects by default. The HTTP Status Codes plugin is no longer nececessary for this functionality.
HTTP status codes are no longer wiped when a request becomes pending
New Features
requestProperties
to your actions. These are additional properties that
will be added to the Request Object in the state.Breaking Changes
Breaking Changes
Breaking Changes
0
would cause error messages to be logged in certain situations. Also,
they would not be deleted when using the built-in delete action type. This issue has been resolved.The file names for the UMD builds were incorrect. Previously, it was redux-resource-prop-types.min.js
.
Now, it is redux-resource-action-creators.min.js
.
This change should not impact Webpack, Node, nor Browserify users. It only impacts developers who were using this path directly in their application code.
Today's updates include features that make it easier to work with related resources.
upsertResources
and setResourceMeta
now accept an Object for resources
as well as an Array.2.x
API.Bug Fixes
All libraries have been updated to fix an issue with the ES Modules build where the Babel helpers were not included in the bundle. The published package versions with this fix are:
Bug Fixes
request
or resources
attribute is missing from
an action has been fixed. Previously, it would suggest that adding a "list"
would resolve the warning, but that's not true!New Features
qsStringify
and qsStringifyOptions
XHR options. For more, refer
to the documentation.Breaking Changes
resourceIdsPropType
has been removedslicePropType
has been removedresourcesPropType
has been removedNew Features
New Features
getStatus
now supports bracket notation for pathing. For instance,
getStatus(state, 'books.resources[24].readStatus')
.Changes
Changes
New Features
getResources
has a new signature that only accepts two arguments. This makes it easier to use
getResources
in applications that aren't using combineReducers
. Read more on
the API documentation page.Deprecations
getResources
that accepts three arguments.New Features
getResources
now accepts a filter function. Read more on
the API documentation page.Note: No changes were made from
2.0.0-beta1
.
Here is a summary of changes between 1.0.x and 2.0.0:
Breaking Changes
getResources
now returns resources from lists, rather than requests.labels
section of a slice has been renamed to be requests
.resourceful-redux
to be redux-resource
New Features
resourceful-redux
library now supports lists, which separates two use
cases both previously managed by labels
. Lists are designed to track ordered
collections of resources, like results from a search or a 'most popular books'.
Labels are now able to focus solely on named requests that aren't necessarily
tied to specific resources (e.g. to track the creation of new resources that
may not have IDs yet). For more info, refer to #187 or read further in
our docs.Bug Fixes
getResources
now works properly.Breaking Changes
getResources
now returns resources from lists, rather than requests.labels
section of a slice has been renamed to be requests
.resourceful-redux
to be redux-resource
New Features
New Features
resourceful-redux
library now supports lists, which separates two use
cases both previously managed by labels
. Lists are designed to track ordered
collections of resources, like results from a search or a 'most popular books'.
Labels are now able to focus solely on named requests that aren't necessarily
tied to specific resources (e.g. to track the creation of new resources that
may not have IDs yet). For more info, refer to #187 or read further in
our docs.New Features
resourceful-xhr
library now supports an alternative API that allows for
better chaining of requests. For more, refer to issue #190. The old API is
still supported, but it will be removed in resourceful-xhr@2.0.0.Breaking Changes
has been removed. Only the API introduced
in
resourceful-xhr@1.2.0` is now available.The resourceful-action-creators
library has been renamed to resourceful-xhr
.
New Features
callback(err, res, body)
that is invoked after the XHR is complete and dispatch()
events trigged.Bug Fixes
New Features
resourceful-plugins
: A new library has been added, resourceful-plugins
.
This is a collection of of common plugins that you can use for your CRUD apps.Changes
Breaking Changes
resourceful-action-creators
: All end actions now always pass the res
objectresourceful-action-creators
: The actions now pass a statusCode
property,
which represents the current status code of the request.Bug Fixes
resourceful-action-creators
: The xhr
object will now be returned when
using the shorthand action creators (such as readResources
).Changes
Breaking Changes
console.error
, rather than console.warn
Bug Fixes
undefined
within slice.meta
Changes
Bug Fixes
Bug Fixes
Breaking Changes
isRequired
by default. It is
now opt in.Bug Fixes
xhr
(such as xhr.get
) now accept all of the same signatures as the xhr
lib.console.warn
in Resourceful Redux that wasn't warning when it should
have been warning.Bug Fixes
The Action Creators extension will now return the resources
array that you
pass as options when a successful response is received from the backend
without a response body.
The name of the delete metadata has now been normalized as deleteStatus
.
Breaking Changes
Bug Fixes
Breaking Changes
Resourceful Action Creators and Resourceful Prop Types are no longer included
with the resourceful-redux
npm package. They may be reintroduced, but there
were too many bugs with the implementation being used. You can now install
each collection of extras from npm directly.
New warning messages and Errors will be thrown when common mistakes are made when using the API.
Bug Fixes
Breaking Changes
resources
Array is now an Object. This will only be breaking if you're
accessing or modifying the resources
Array directly. If you're using
getResources
for accessing resources, and upsertResources
for updating
resources, then this change will not be breaking.Bug Fixes
New Features
npm
package: Resourceful Prop Types and
Resourceful Action Creators.New Features
getResources
methodBug Fixes
pending
was set to true
anytime treatNullAsPending
was true
when calling getStatus
.New Features
getStatus
,
which can be used to check if the request status is "NULL"
.mergeLabelIds: false
will now clear the label's IDs array.This library began as a fork of redux-simple-resource v1.0.0.