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

Combine observables using merge/scan #140

Merged
merged 1 commit into from Jan 23, 2018

Conversation

mariusmuja
Copy link
Collaborator

@mariusmuja mariusmuja commented Dec 28, 2017

This PR refactors the way the VNode observables are combined, using merge & scan (and explicit VNode state) instead of combineLatest.

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.

Observable(Seq.empty)
}

// only use last encountered observable per attribute
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Member

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Member

@fdietze fdietze left a comment

Choose a reason for hiding this comment

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

LGTM

@mariusmuja
Copy link
Collaborator Author

I'd like to get a second review on this before merging it.

@fdietze
Copy link
Member

fdietze commented Jan 22, 2018

@cornerman @LukaJCB

}
}

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 {
Copy link
Member

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.

@cornerman
Copy link
Member

@mariusmuja Could you kindly rebase on master? :)

@mariusmuja
Copy link
Collaborator Author

Rebased on master.

@cornerman cornerman merged commit 3dda8ca into outwatch:master Jan 23, 2018
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.

None yet

3 participants