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
Combine observables using merge/scan #140
Conversation
bbc78dd
to
cf95f8a
Compare
cf95f8a
to
1fe5c42
Compare
Observable(Seq.empty) | ||
} | ||
|
||
// only use last encountered observable per attribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a test for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very much at the core of the library, all tests that contain VDOM Observables are tests for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was referring to:
// only use last encountered observable per attribute
I was just wondering if we have a test for this, else I would write one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1fe5c42
to
91c11ac
Compare
91c11ac
to
61a1e80
Compare
61a1e80
to
0eada3d
Compare
I'd like to get a second review on this before merging it. |
0eada3d
to
e0944d5
Compare
} | ||
} | ||
|
||
private[outwatch] case class VNodes(nodes: List[ChildVNode], streamStatus: StreamStatus) extends Children { | ||
private[outwatch] case class VNodes(nodes: List[ChildVNode], hasStream: Boolean = false) extends Children { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the default argument here, because you can easily create an invalid state here, so you should think about this argument when constructung this VNodes class.
@mariusmuja Could you kindly rebase on master? :) |
e0944d5
to
766238c
Compare
Rebased on master. |
This PR refactors the way the VNode observables are combined, using
merge
&scan
(and explicit VNode state) instead ofcombineLatest
.I think it makes the code simpler and removes the need for workarounds such as keeping track if there's one or more child observables or making sure there's a
startWith
on the streams for partial rendering, avoiding issues such as #137, #134.