ReactiveX/rxjs

Version 7 -> 8 Roadmap

benlesh opened this issue ยท 17 comments

NOTE (10/28/2024): RxJS 8 is on hold while observable is being standardized for the web platform. RxJS 8 should match the web platform as much as possible and support it directly. 7.0 is stable, running well, and overall solid.

This issue is outlining what needs to be done in version 7 before we can move to version 8 in earnest.

  1. Once ALL items in version 7 are complete, we can consider moving the 8.x branch to master, and create a 7.x` branch.
  2. Once ALL items in version 8 are finalized and implemented, we can move from 8.x.x-alpha to 8.x.x-beta.

In Version 7

  • groupBy config (#5679)
  • share observable resets (#6169)
  • splitBy (#3807)
  • Add all exports to top level
  • More configurable retry (#6421)
  • More configurable repeat (#6640)
  • Deprecate MapTo variants (#6399, PR: #6860)
  • Deprecate retryWhen/repeatWhen? (#6859)
  • Deprecate onErrorResumeNext operator in favor of onErrorResumeNextWith (#6755)
  • Various selectors/arguments should support ObservableInput
    • delayWhen's notifier (#7049),
    • buffer's closingNotifier (#7073),
    • distinct's flushes (#7081),
    • repeatWhen's notifier (#7103),
    • sample's notifier (#7104),
    • retryWhen's notifier (#7105),
    • sequenceEqual's compareTo (#7102),
    • ShareConfig's resetOnError, resetOnComplete and resetOnRefCountZero (#7093),
    • skipUntil's notifier (#7091) and
    • window's windowBoundaries (#7088)

Before Version 8 is released

  • Remove all deprecated APIs marked to be removed in v8 or marked deprecated ages ago.
  • Remove source parameters from predicates. (Deprecating these via the type system effects problems - see #6361.)
  • Ensure we're publishing only ES2021 or later and CJS. Drop tslib. (#6321)
  • Drop all Internet Explorer support into a pit of flames! ๐Ÿ”ฅ IE ๐Ÿ”ฅ ๐Ÿฅณ
  • Idempotent subscription add (#6401)
  • Replace all external uses of any with unknown. (This could likely be non-breaking, FWIW.)
  • productize our internals for creating operators (#6803)
  • Implement [Symbol.asyncIterator]() on Observable (TBD. We should try this out in an alpha, at least. Issue: #6857)
  • Convert repo to monorepo (#6786)
    • Docs app can be a separate project under monorepo
    • Operator Decision Tree can also likely be its own project under monorepo
    • Keep rxjs as "whole package". (It's not going away, ever, really)
    • Publish @rxjs/observable with just Observable.
    • Publish @rxjs/ajax
    • Publish @rxjs/fetch
    • Publish @rxjs/testing
    • Decide on how we'll do other packages: Current thoughts are that we could publish a package for each operator, even. Subjects and multicasting might be trickier, but maybe not. Maybe individual packages is right for all. Needs discussion.
  • ??? TBD

During Version 8

  • Create new schedulers and deprecate old schedulers.
  • Implement Symbol.asyncIterator on observable. (#6779)

๐Ÿ”ฅ IE ๐Ÿ”ฅ ๐Ÿฅณ - every time I see that statement in some repo it makes my day better

Since "??? TBD" seems to imply we can suggest anything, what about #2686?

It seems to be a recurring "issue" people are having to configure headers for every request (most popular seem to be Bearer, CorrelationId and Content-Type).

While it's not "hard" to make your own ajax, I feel it's a bit sad everyone has to write that piece of code and it might be helpful for everyone to have an helper provided by rxjs.

Wouldn't publishing multiple packages for what is essentially the same code actually increase risk of non tree shakable use-case and thus increase bundle size ?

As seen with lodash, if one of my dependency decides to depends on the future @rxjs/observable, but my app depends on the current rxjs, then all the code from @rxjs/observable will essentially be bundled twice, won't it ?

And of course it would be much worse if we actually publish a package for each operator. Then a single operator could be bundled three times if my deps happened to depend on rxjs, @rxjs/operators and say @rxjs/operators-map.

I could also imagine compatibility issues if one of my dependency depends on an old version of @rxjs/observable and my app pass one of those object to a new, incompatible version of an operator coming from the latest version of rxjs. This kind of issue already happened with the graphql package where they had to add manual check in their code to throw error if it happens.

That seems a lot of tricky tradeoffs to attempt to solve the issue of bundle size that is already properly solved by tree shaking.

Is that really worth it ? ๐Ÿค”

It looks like the items for version 7 are all done except one. Is there any progress? Feels a bit stagnated ):

Do you honestly think this signature change on the subscribe, etc. methods is critical enough to cause billions of lines of code change across the internet?

You seem to have "Publish @rxjs/fetch" twice. I'm sure it will be an awesome package but it probably only needs to be done once ๐Ÿ˜‹

@benlesh, it seems development toward v8 is picking up lately. However I am not aware that the concerns expressed in #6367 (comment) and #6786 (comment) have been addressed. And it seems a few persons are sharing those concerns.

Is the plan still to split in multiple, possibly redundant, packages ? What's the team opinion about the pitfalls of such a strategy, as experienced by lodash and graphql (for example) ?

43081j commented

have you considered 8.x being your first esm-only version of rxjs? seems to me it is the ideal opportunity to do that.

we're now at a point where most consumers are on a version of node which is capable of importing ESM packages, and all popular bundlers are too.

anyone who can only use CJS must be on a fairly old node version, so are likely going to be fine sticking to rxjs 7.x.

there's a few hazards and disadvantages with dual packages (esm + cjs), and the complexity of the build scripts for contributors/maintainers etc.

you mentioned you considered publishing CJS and ESM packages separately, but i wouldn't bother to be honest. many other packages have already moved to pure ESM and consumers managed fine, imo we could do the same here.

Just tested latest alpha release and these errors appear, is that on purpose? If yes, I would go and open issues on GH for these.
SCR-20240102-odhu

Wouldn't publishing multiple packages for what is essentially the same code actually increase risk of non tree shakable use-case and thus increase bundle size ?

It shouldn't... rxjs itself will re-export @rxjs/observable, @rxjs/fetch, et al. So there's only really one copy of those dependencies. The only real risk is the same risk we've always had, where a dependency can depend on rxjs@7, and some other dep uses rxjs@6, and then you can depend on rxjs@8 and you end up with three different versions in your codebase... you're doomed in that scenario even WITHOUT this change.

Do you honestly think this signature change on the subscribe, etc. methods is critical enough to cause billions of lines of code change across the internet?

Yes. In order to align with native observables, the change to subscribe is required to move forward. However, you're wrong that it will "cause billions of lines of code change". Whatever version of RxJS that code is using will still exist. There's very, very little chance of any security issues or reasons to change those old versions, and if there were, we'd just fix it and publish a new 7.x or whatever.

have you considered 8.x being your first esm-only version of rxjs?

We can't really do this yet. There are way too many people using RxJS with CJS still. Myself included.

For those of you wondering about the path of different packages for each thing... the primary motivator is around how many libraries choose to use some other, untested, and or cobbled-together observable implementation because they "don't want all of RxJS". This causes us to end up shipping our observables alongside other people's observables in the same bundles, and then it causes developers to need to deal with interop, etc.

Ideally, we can convince developers that want observables to use the most battle tested and common implementation, at least until native observables land.

What is the status of this?

Right now, version 8 is on hold because it doesn't make sense to release a new major version of RxJS, then have to write a new major version to match the observable landing in the Web Platform.

@benlesh Is the idea then that version 8 will eventually be released using a polyfilled version of the Web Platform observable?

There will be an optional polyfill, or an identical observable to directly import. The RxJS observable will pass all web platform tests as well, and there will be some backwards compat solution.