Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge refactor #316

Merged
merged 18 commits into from
Sep 16, 2015
Merged

Merge refactor #316

merged 18 commits into from
Sep 16, 2015

Conversation

benlesh
Copy link
Member

@benlesh benlesh commented Sep 15, 2015

Due to problems outlined in #302, I ended up adding more virtual time tests and found quite some behaviors weren't working as expected. Since #222 is still open, and it's something I wanted to tackle, and since the high level of inheritance in operators like switchAll made debugging a little painful, I opted for a refactor.

Unfortunately, refactoring merge touched a lot of other operators (concat, concatAll, switchAll, switchLatest, switchLatestTo, flatMap, flatMapTo, merge, mergeAll, Observable.merge, Observable.concat, and expand)

The basics of the changes are as follows:

  • expand has it's own standalone subscriber
  • flatMap has it's own standalone subscriber
  • switchAll has it's own standalone subscriber
  • mergeAll has it's own standalone subscriber
  • switchLatest (which should be switchMap) inherits from flatMap subscriber
  • flatMapTo inherits from flatMap subscriber
  • switchLatestTo inherits from flatMapTo subscriber

other changes were just changes to calls to reflect better typing information.

Also, I had to fix a bug in the TestScheduler that was having hot observables subscribe and emit before the expectation observables did. This meant that if a subject (hot observable) emitted on frame 0, it wouldn't be provided to the expectation observable being tested because it hadn't subscribed yet.

sincerest apologies for such a large PR

... at least I broke it into several commits.

- moves support types from merge-support to mergeAll-support
- fixes strange issues with async
- adds virtual time tests for merge and mergeAll
- adds virtual time tests for expand
- refactors expand to be its own operator, reducing inheritence
- removes inheritance from merge
- improves performance through fewer function calls
- ensures scalar (same behavior as before, but readded)
- still inherits from flatMap, but flatMap has changed slightly
makes ability to schedule more apparent
- make ability to schedule more apparent
- check for scheduler and insert concurrency of 1 at proper point for merge call
@benlesh
Copy link
Member Author

benlesh commented Sep 15, 2015

Oh, one additional thing...

  • Added concurrency limit to expand operator.

@benlesh benlesh merged commit d65e7ea into ReactiveX:master Sep 16, 2015
constructor(destination: Observer<T>,
project: (value: T, index: number) => Observable<R>,
resultSelector?: (innerValue: R, outerValue: T, innerIndex: number, outerIndex: number) => R2) {
super(destination, project, resultSelector, 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Blesh Does this work? It looks like this makes the SwitchLatestSubscriber equivalent to concat... right?

@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants