-
Notifications
You must be signed in to change notification settings - Fork 28
Make DashboardScope accept Flow instead of StateFlow #507
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
Merged
rteyssandier
merged 2 commits into
openflocon:main
from
snappdevelopment:dashboardscope-accepts-flows
Mar 7, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,6 @@ import kotlinx.coroutines.CoroutineScope | |
| import kotlinx.coroutines.Job | ||
| import kotlinx.coroutines.SupervisorJob | ||
| import kotlinx.coroutines.flow.Flow | ||
| import kotlinx.coroutines.flow.StateFlow | ||
| import kotlinx.coroutines.flow.combine | ||
| import kotlinx.coroutines.flow.flowOf | ||
| import kotlinx.coroutines.flow.map | ||
|
|
@@ -57,10 +56,10 @@ internal class DashboardScopeImpl : DashboardScope { | |
| * The section will be re-rendered whenever the [flow] emits a new value. | ||
| * | ||
| * @param name The name of the section. | ||
| * @param flow The [StateFlow] providing the data for the section. | ||
| * @param flow The [Flow] providing the data for the section. | ||
| * @param content The builder to construct the section content based on the data. | ||
| */ | ||
| override fun <T> section(name: String, flow: StateFlow<T>, content: SectionBuilder.(T) -> Unit) { | ||
| override fun <T> section(name: String, flow: Flow<T>, content: SectionBuilder.(T) -> Unit) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| val sectionFlow = flow.map { item -> | ||
| SectionBuilder(name) | ||
| .apply { content(item) } | ||
|
|
@@ -90,14 +89,14 @@ internal class DashboardScopeImpl : DashboardScope { | |
| * @param name The name of the form. | ||
| * @param submitText The text to display on the submit button. | ||
| * @param onSubmitted The callback to be invoked when the form is submitted. | ||
| * @param flow The [StateFlow] providing the data for the form. | ||
| * @param flow The [Flow] providing the data for the form. | ||
| * @param content The builder to construct the form content based on the data. | ||
| */ | ||
| override fun <T> form( | ||
| name: String, | ||
| submitText: String, | ||
| onSubmitted: (Map<String, String>) -> Unit, | ||
| flow: StateFlow<T>, | ||
| flow: Flow<T>, | ||
| content: FormBuilder.(T) -> Unit | ||
| ) { | ||
| val formFlow = flow.map { item -> | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
With
StateFlowbeing replaced byFlowthroughout this interface, theimport kotlinx.coroutines.flow.StateFlowon line 6 is now unused and can be removed.