RxJs v7.0.0-beta.5 Release Notes
Release Date: 2020-09-03 // over 3 years ago-
๐ Bug Fixes
- ajax: Allow XHR to perform body serialization and set content-type where possible (d8657ed), closes #2837
- ajax: Do not mutate headers passed as arguments (0d66ba4), closes #2801
- bindCallback: now emits errors that happen after callback (2bddd31)
- bindNodeCallback: now emits errors that happen after callback (edc28cf)
- buffer: Ensure notifier is subscribed after source (#5654) (c088b0e), closes #2195 #1754
- catchError: ensure proper handling of async return for synchronous source error handling (#5627) (1b29d4b), closes #5115
- catchError: inner synchronous observables will properly terminate (#5655) (d3fd2fb)
- errors: Custom RxJS errors now all have a call stack (#5686) (9bb046c), closes #4250
- onErrorResumeNext: observables always finalized before moving to next source (#5650) (ff68ad2)
- ๐ฆ package.json: change homepage setting to official docs site. (#5669) (e57c402)
- repeat: Ensure teardown happens between repeated synchronous obsโฆ (#5620) (0ca8a65)
- repeatWhen: Ensure teardown happens between repeat subscriptions (#5625) (98356f4)
- retry: Ensure teardown happens before resubscription with synchronous observables (6f90597), closes #5620
- retryWhen: Ensure subscription tears down between retries (#5623) (6752af7)
- throttleTime: ensure the spacing between throttles is always at least the throttled amount (#5687) (ea84fc4), closes #3712 #4864 #2727 #4727 #4429
- zip: zip operators and functions are now able to zip all iterable sources (#5688) (02c3a1b), closes #4304
switchMap
andexhaustMap
behave correctly with re-entrant code. (c289688)- webSocket: close websocket connection attempt on unsubscribe (e1a671c), closes #4446
๐จ Code Refactoring
- ajax: Use simple Observable (17b9add)
- Subscriber: remove _unsubscribeAndRecycle (d879c3f)
- โฑ VirtualTimeScheduler: remove sortActions from public API (#5657) (a468f88)
๐ Features
- โ combineLatest: add N-args signature for observable inputs (#5488) (fcc47e7)
- Subscription:
add
no longer returns unnecessary Subscription reference (#5656) (4de604e) - Subscription:
remove
will now remove any teardown by reference (#5659) (1531152) - throwError: now accepts a factory to create the error (#5647) (dad270a), closes #5617
- ๐ useDeprecatedNextContext: Puts deprecated next context behavior behind a flag (dfdef5d)
- ๐ support schedulers within run (#5619) (c63de0d)
๐ Performance Improvements
- SafeSubscriber: avoid using
Object.create
(40a9e77)
๐ฅ BREAKING CHANGES
ajax:
ajax
body serialization will now use default XHR behavior in all cases. If the body is aBlob
,ArrayBuffer
, any array buffer view (like a byte sequence, e.g.Uint8Array
, etc),FormData
,URLSearchParams
,string
, orReadableStream
, default handling is use. If thebody
is otherwisetypeof
"object"
, then it will be converted to JSON viaJSON.stringify
, and theContent-Type
header will be set toapplication/json;charset=utf-8
. All other types will emit an error.- The
Content-Type
header passed toajax
configuration no longer has any effect on the serialization behavior of the AJAX request. - For TypeScript users,
AjaxRequest
is no longer the type that should be explicitly used to create anajax
. It is nowAjaxConfig
, although the two types are compatible, onlyAjaxConfig
hasprogressSubscriber
andcreateXHR
.
zip:
zip
operators will no longer iterate provided iterables "as needed", instead the iterables will be treated as push-streams just like they would be everywhere else in RxJS. This means that passing an endless iterable will result in the thread locking up, as it will endlessly try to read from that iterable. This puts us in-line with all other Rx implementations. To work around this, it is probably best to usemap
or some combination ofmap
andzip
. For example,zip(source$, iterator)
could besource$.pipe(map(value => [value, iterator.next().value]))
.Subscription:
add
no longer returns an unnecessary Subscription reference. This was done to prevent confusion caused by a legacy behavior. You can now add and remove functions and Subscriptions as teardowns to and from aSubscription
usingadd
andremove
directly. Before this,remove
only accepted subscriptions.RxJS Error types Tests that are written with naive expectations against errors may fail now that errors have a proper
stack
property. In some testing frameworks, a deep equality check on two error instances will check the values instack
, which could be different.๐ Undocumented Behaviors/APIs Removed:
unsubscribe
no longer available via thethis
context of observer functions. To reenable, setconfig.useDeprecatedNextContext = true
on the rxjsconfig
found atimport { config } from 'rxjs';
. Note that enabling this will result in a performance penalty for all consumer subscriptions.- Leaked implementation detail
_unsubscribeAndRecycle
ofSubscriber
has been removed. Just use newSubscription
objects - Removed an undocumented behavior where passing a negative count argument to
retry
would result in an observable that repeats forever. - An undocumented behavior where passing a negative count argument to
repeat
would result in an observable that repeats forever. - The static
sortActions
method onVirtualTimeScheduler
is no longer publicly exposed by our TS types.
throwError: In an extreme corner case for usage,
throwError
is no longer able to emit a function as an error directly. If you need to push a function as an error, you will have to use the factory function to return the function like so:throwError(() => functionToEmit)
, in other wordsthrowError(() => () => console.log('called later'))
.