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 and exhaustMap 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 a Blob, ArrayBuffer, any array buffer view (like a byte sequence, e.g. Uint8Array, etc), FormData, URLSearchParams, string, or ReadableStream, default handling is use. If the body is otherwise typeof "object", then it will be converted to JSON via JSON.stringify, and the Content-Type header will be set to application/json;charset=utf-8. All other types will emit an error.
      • The Content-Type header passed to ajax 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 an ajax. It is now AjaxConfig, although the two types are compatible, only AjaxConfig has progressSubscriber and createXHR.
    • 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 use map or some combination of map and zip. For example, zip(source$, iterator) could be source$.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 a Subscription using add and remove 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 in stack, which could be different.

    • ๐Ÿšš Undocumented Behaviors/APIs Removed:

      • unsubscribe no longer available via the this context of observer functions. To reenable, set config.useDeprecatedNextContext = true on the rxjs config found at import { config } from 'rxjs';. Note that enabling this will result in a performance penalty for all consumer subscriptions.
      • Leaked implementation detail _unsubscribeAndRecycle of Subscriber has been removed. Just use new Subscription 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 on VirtualTimeScheduler 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 words throwError(() => () => console.log('called later')).