Releases: joanllenas/ngx-remotedata
Releases Β· joanllenas/ngx-remotedata
v8.0.0
v7.0.1
- Ivy enabled
v7.0.0
- Added Angular >= 13 support
v6.1.1
Exported RemoteData
variant interfaces to avoid ...has or is using name 'NotAsked' | 'Success' | 'Failure' | 'InProgress' from external module ".../node_modules/ngx-remotedata/lib/remote-data" but cannot be named.
errors.
v6.1.0
v6.0.1
Fixes
- Added more thorough checks to
isRemoteData
,isSuccess
,isFailure
,isInProgress
andisNotAsked
type guards.
v6.0.0
Migration
- If you come from
v5.0.0
you probably don't have to do anything. - If you come from
v3.1.0
it's recommended to first install v5.0.0, which is a transitional release that marks old APIs as deprecated. After migrating all deprecations you can safely installv6
.
In this release
- Added
chain()
API. (docs)
Breaking changes
- Removed all APIs that were marked as deprecated and replaced by new ones:
Old API | New API |
---|---|
RemoteDataTags |
- |
AnyRemoteData |
RemoteData<any, any> |
NotAsked.of() |
notAsked() |
InProgress.of() |
inProgress() |
Failure.of() |
failure() |
Success.of() |
success() |
InProgress::value() |
InProgress::value |
Failure::value() |
Failure::value |
Failure::error() |
Failure::error |
Success::value() |
Success::value |
- All
RemoteData
variants are plain JavaScript objects, so you won't be able to useinstanceof
to discriminate between them. Use the type guards or folds instead:
Type guards
type User = { email: string };
const myRemoteData: RemoteData<User> = failure('Something went wrong.', {
email: '[email protected]'
});
// (...)
if (isFailure(myRemoteData)) {
// Here myRemoteData is narrowed to Failure
console.log(`This is the failure: ${myRemoteData.error}`);
console.log(`I have some data: ${myRemoteData.value.email}`);
}
Fold
const rd = success('this is fine!');
const result = fold(
() => 'not asked',
val => 'in progress: ' + val,
(error, value) => `failure: ${error} ${value}`,
value => 'success: ' + value,
rd
);
console.log(result); // success: this is fine!
- If you were using the custom
localStorageSyncReducer
reducer to persist / rehydrate the store now it is not needed anymore, you can use the library without any hacks. Check the ngrx example in the demo app.
v5.1.0
v5.0.0
In this release:
v4 never existed. I skipped it by mistake. Sorry for the confusion.
This release should be mostly backwards compatible with v3.1.0
, but there are a few accidental features that you may have breaking changes if you rely on them (see the breaking changes section below).
πͺ Improved APIs:
successValue
pipe: Added new optionaldefaultValue
argument. (docs)inProgressValue
pipe: Added new optionaldefaultValue
argument. (docs)- All
RemoteData
variants now expose areadonly tag
property.
π New APIs:
Check the API section for detailed information.
- Constructor functions:
notAsked()
inProgress()
failure()
success()
- Guard functions:
isNotAsked()
isInProgress()
isFailure()
isSuccess()
isRemoteData()
- Extract functions:
π Deprecations:
- Added deprecation messages to some APIs that will be removed in the next major release.
π Misc. Improvements
- Addressed various issues related to Ts strict mode and templates strict mode compliance.
- Improved documentation.
- Increased test coverage.
- Improved types.
- Internally, the library and example app are compiled with Angular 11 and strict mode / strict templates.
π BREAKING CHANGES:
- If you relied on pipes
transform()
function throwing exceptions (viatry{}catch()
), you should be aware that from v5 on,null
andundefined
don't throw anymore because they are valid values.
π Here be bugs
This release has touched a lot of stuff so, If you find any bugs, please consider opening an issue, I'll address it ASAP.
Thanks!