Releases: oberonamsterdam/react-api-data
Releases · oberonamsterdam/react-api-data
1.2.0
New features
- Instead of only handling JSON responses, apiData can handle all fetch response body interface methods (https://developer.mozilla.org/en-US/docs/Web/API/Response#body_interface_methods). The parseMethod can be defined globally or per endpoint and defaults to JSON.
1.1.2
Fixes
- Fix a bug with the autoTrigger config override in the useApiData hook
- Added some deprecation notices on previously deprecated methods
1.1.1
Fixes
- Fix a problem with redux persist.
1.1.0 React Suspense support
New features
- support for React Suspense, which can be enabled in the config. See this example
1.0.1 SSR release
New features
- You can now use
getDataFromTree
to run your requests from the server side.
For more info, see the API spec or the new with-next example
Breaking changes
None
Deprecations
None
1.0.0
New features:
- It is now possible to provide endpoints with default values for the params. (see docs).
- It is now possible to provide config overrides in the hook and the hoc (see the
config
parameter in useApiData). - Added property dataFailed, which contains the body of a failed call.
- The perform promise will now reject, when the request fails.
- Added possibility to purge individual requests via the binding and the actions.
- All function names containing ApiData, have been renamed to a name without ApiData. The old names are hereby deprecated and will be removed in a future release.
Breaking changes:
- The
data
property no longer contains the data of a failed call. - The perform promise will now reject, when the request fails. This means that code depending on a failed response should be moved to the catch clause of the promise.
- The third parameter of the
useApiData
hook, changed from instanceId string to an options object, solve this by placing the string in this object:{ instanceId: 'myInstanceIdString' }
Deprecations:
- All function names containing ApiData, have been renamed to a name without ApiData. The old names are hereby deprecated and will be removed in a future release.
Improved callbacks [breaking]
Includes consistent config callbacks for beforeSuccess, afterSuccess, beforeFailed and afterFailed.
Breaking changes:
- Callback arguments have been combined into one object, so you can easily cherry pick what you need using destructuring.
Update your code by adding destructuring:
Old:afterSuccess: (request, dispatch) => {}
New:afterSuccess: ({ request, dispatch }) => {}