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

BehaviorSubject created with "create" does not have getValue() method #1890

Closed
acheshkov opened this issue Aug 22, 2016 · 7 comments
Closed
Labels
bug Confirmed bug

Comments

@acheshkov
Copy link

acheshkov commented Aug 22, 2016

RxJS version: 5.0.0-beta.9

Code to reproduce:

`
var a = new Rx.BehaviorSubject('start');

var b = Rx.BehaviorSubject.create(a, new Rx.Observable(o => {
a.subscribe(o);
}));

console.log(b.getValue());

`

Expected behavior:
// output:
start

Actual behavior:

Uncaught TypeError: getValue is not a function

Additional information:

@kwonoj
Copy link
Member

kwonoj commented Aug 22, 2016

yes, behaviorSubject does not override create so it doesn't return instance of behaviorsubject. @Blesh is this intended, or just oversight that need to be updated?

edited: looking into RxJS4 impl, it seems create is not expected to be exposed to behaviorSubject or some other variants.

@jayphelps
Copy link
Member

To me, this seems like a similar problem to #1876 and #1829 with static operators not deferring to the current class type.

We may decide that subjects do not have these static operators on principle, but technically speaking I think it might be valuable if we could support it.

@kwonoj
Copy link
Member

kwonoj commented Aug 22, 2016

so suggestions to support variant of creation method as similar to of or etcs? I'm ok with that PR was created for simple alignment of interfaces (and at least get rid of unexpected creation method behavior).

@jayphelps
Copy link
Member

jayphelps commented Aug 22, 2016

I'm personally OK with accepting your #1894 PR to fix this bug and then add new functionality later, if we choose to do so. That seems like a much longer conversation and I don't want it to block v5.0.0 release.

@kwonoj
Copy link
Member

kwonoj commented Aug 22, 2016

I'm personally OK with accepting your #1894 PR

: makes sense, let's continue discussion in PR if it's acceptable or not (including details of implementation as well). We could leave this issue opened for further goals if PR's agreed to check in.

@benlesh
Copy link
Member

benlesh commented Aug 23, 2016

This was an oversight. It should have the same arguments as the constructor and return a BehaviorSubject

@benlesh
Copy link
Member

benlesh commented Oct 2, 2019

create static methods are going away. This is obsolete.

@benlesh benlesh closed this as completed Oct 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants