Skip to content

Commit

Permalink
Consider empty list when combining.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaynewstrom-stripe committed May 6, 2024
1 parent e98f1eb commit 30c0d0e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,12 @@ internal class FormViewModel @Inject internal constructor(
return defaults
}

private val textFieldControllerIdsFlow = combineAsStateFlow(elements.map { it.getTextFieldIdentifiers() }) {
it.toList().flatten()
private val textFieldControllerIdsFlow = if (elements.isEmpty()) {
stateFlowOf(emptyList())
} else {
combineAsStateFlow(elements.map { it.getTextFieldIdentifiers() }) {
it.toList().flatten()
}
}

val lastTextFieldIdentifier = combineAsStateFlow(
Expand Down

0 comments on commit 30c0d0e

Please sign in to comment.