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

feat(binding): immediately update the target if the Observable has a BehaviorSubject-like current value member #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

james-voth
Copy link

Hi Vildan. As the title says, this change ensures that the target is immediately updated if the Observable has a BehaviorSubject-like current value member.

Copy link
Owner

@zewa666 zewa666 left a comment

Choose a reason for hiding this comment

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

Good idea to support Subjects as well. Would you mind adding a few unit tests along the PR?

if ("value" in a) {
binding.originalupdateTarget((a as any).value)
} else if (typeof (a as any).getValue === "function") {
binding.originalupdateTarget((a as any).getValue())
Copy link
Owner

Choose a reason for hiding this comment

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

does that really make a difference? I mean if you subscribe to a BehaviorSubject the subscription will fire right away with the current value.

@zewa666
Copy link
Owner

zewa666 commented Nov 23, 2018

the request for unit tests was merely to show some use-cases you'd like this addition to handle. Given the above comment I'm not sure what other benefit this could currently have.

@james-voth
Copy link
Author

Hi Vildan. My apologies for the delay in responding to your request for unit tests. Indeed, the behaviour that you described in your comment (i.e. the BehaviorSubject firing on subscription as per http://reactivex.io/rxjs/manual/overview.html#behaviorsubject) was what I had expected. However, there were a number of cases where the views were not being updated as expected when they were initially attached.

I will try and extract a minimal reproduction of this in the coming days.

@zewa666
Copy link
Owner

zewa666 commented Feb 4, 2020

@james-voth any updates? did you have a chance to look at it again? Quite a while ago though ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants