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

fix(bindCallback): create subject within factory #6369

Merged

Conversation

cartant
Copy link
Collaborator

@cartant cartant commented May 6, 2021

Description:

This PR fixes bindCallback and bindNodeCallback. In v6 the internal subject was created in the factory that returns the bound observable:

return function (this: any, ...args: any[]): Observable<T> {
const context = this;
let subject: AsyncSubject<T>;

However, in v7, the subject creation was inadvertently moved outside of the factory:

// We're using AsyncSubject, because it emits when it completes,
// and it will play the value to all late-arriving subscribers.
const subject = new AsyncSubject<any>();
return function (this: any, ...args: any[]): Observable<any> {

With it outside of the factory, calls subsequent to the first were ineffectual: the arguments passed were ignored and the previous result was returned.

This PR add some failing tests and moves the subject creation back into the factory.

Related issue (if exists): Nope

@cartant cartant requested a review from benlesh May 6, 2021 07:25
@cartant cartant added the 7.x Issues and PRs for version 6.x label May 6, 2021
@benlesh benlesh merged commit abf2bc1 into ReactiveX:master May 6, 2021
@cartant cartant deleted the cartant/bind-callback-subject-within-factory branch May 15, 2021 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7.x Issues and PRs for version 6.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants