-
Notifications
You must be signed in to change notification settings - Fork 294
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
[KTLN-759] Combine 2 Kotlin State Flows Into a Single State Flow #1093
base: master
Are you sure you want to change the base?
Conversation
<dependency> | ||
<groupId>org.jetbrains.kotlinx</groupId> | ||
<artifactId>kotlinx-coroutines-test</artifactId> | ||
<version>1.7.3</version> | ||
<type>pom</type> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jetbrains.kotlinx</groupId> | ||
<artifactId>kotlinx-coroutines-core</artifactId> | ||
<version>1.8.1</version> | ||
<type>pom</type> | ||
<scope>runtime</scope> | ||
</dependency> |
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.
Let's extract these versions as properties.
See line 53 for an example of that.
<dependency> | |
<groupId>org.jetbrains.kotlinx</groupId> | |
<artifactId>kotlinx-coroutines-test</artifactId> | |
<version>1.7.3</version> | |
<type>pom</type> | |
</dependency> | |
<dependency> | |
<groupId>org.jetbrains.kotlinx</groupId> | |
<artifactId>kotlinx-coroutines-core</artifactId> | |
<version>1.8.1</version> | |
<type>pom</type> | |
<scope>runtime</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.jetbrains.kotlinx</groupId> | |
<artifactId>kotlinx-coroutines-test</artifactId> | |
<version>${kotlinx-coroutines.version}</version> | |
<type>pom</type> | |
</dependency> | |
<dependency> | |
<groupId>org.jetbrains.kotlinx</groupId> | |
<artifactId>kotlinx-coroutines-core</artifactId> | |
<version>${kotlinx-coroutines.version}</version> | |
<type>pom</type> | |
<scope>runtime</scope> | |
</dependency> |
<groupId>org.jetbrains.kotlinx</groupId> | ||
<artifactId>kotlinx-coroutines-test</artifactId> | ||
<version>1.7.3</version> | ||
<type>pom</type> |
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.
Why is this a pom
type? Wouldn't this just be a normal dependency? If anything, wouldn't this be a <scope>test</scope>
dependency?
<type>pom</type> | |
<scope>test</scope> |
<type>pom</type> | ||
<scope>runtime</scope> |
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 don't think we need this type
declaration, and this is probably a compile
dependency, so we shouldn't need this scope
declaration here.
<type>pom</type> | |
<scope>runtime</scope> |
// @Test | ||
// fun `zip operator waits for both flows to emit`() = runTest { | ||
// val stateFlow1 = MutableStateFlow(5) | ||
// val stateFlow2 = MutableStateFlow("Hi") | ||
// | ||
// val zippedStateFlow = stateFlow1.zip(stateFlow2) { value1, value2 -> | ||
// value1 to value2 | ||
// } | ||
// | ||
// assertEquals(Pair(5, "Hi"), zippedStateFlow.first()) | ||
// | ||
// stateFlow1.value = 11 | ||
// | ||
// assertEquals(Pair(11, "Hi"), zippedStateFlow.first()) | ||
// | ||
// stateFlow2.value = "World" | ||
// assertEquals(Pair(11, "World"), zippedStateFlow.first()) | ||
// } | ||
|
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 test looks like it would be very promising, can we use this style instead?
Added unit tests