-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Possible bug: can no longer merge and takeUntil on the same stream #1360
Comments
@bgerm this is technically working as designed, though I can understand your confusion. In RxJS 4 In your example, Whether this behavior is desired can be debated. @Blesh @mattpodwysocki @staltz do you guys feel strongly either way? |
@trxcllnt then I would certainly say that's a bug here and not expected behavior for what was perfectly working code before. |
I believe it makes more sense to subscribe to the source before subscribing to the notifier, but I don't think the example code above is a correct use of RxJS because |
This is something we're looking at changing for the next major version. |
@benlesh I'm migrating code from RxJS 4 to RxJS 5 and I just ran into this issue with messageObservable(script, bindings, rawMessage) {
const command = {
message: this.buildMessage(script, bindings, rawMessage),
}
// This actually sends the command to Gremlin Server
this.commands$.next(command);
// Create a new Observable of incoming messages, but filter only
// incoming messages to the command we just sent.
const commandMessages$ = this.incomingMessages$
.filter(({ requestId }) => requestId === command.message.requestId);
// Off of these messages, create new Observables for each message code
// TODO: this could be a custom operator.
const successMessage$ = commandMessages$
.filter(hasCode(200));
const continuationMessages$ = commandMessages$
.filter(hasCode(206));
const noContentMessage$ = commandMessages$
.filter(hasCode(204));
// That Observable will ultimately emit a single object which indicates
// that we should not expect any other messages;
const terminationMessages$ = Rx.Observable.merge(
successMessage$, noContentMessage$
);
const errorMessages$ = commandMessages$
.filter(isErrorMessage)
.flatMap(({ status: { code, message } }) =>
Rx.Observable.throw(new Error(message + ' (Error '+ code +')'))
);
const results$ = Rx.Observable.merge(
successMessage$,
continuationMessages$,
noContentMessage$,
errorMessages$
)
.takeUntil(terminationMessages$);
return results$;
} In the above code, This was working ok with RxJS 4. Would you suggest a different approach to make that code work with the current behavior (using RxJS v5.4.0 at the moment) of |
Closing as stale |
In RxJS 4 the code below would print 'up' and return to 0, 0 upon releasing the mouse from a drag. In RxJS 5 this is no longer happens.
RxJS 4 jsbin: https://jsbin.com/cigirovohe/1/edit?html,js,console,output
RxJS 5 jsbin: https://jsbin.com/metosonayi/1/edit?html,js,console,output
The text was updated successfully, but these errors were encountered: