Skip to content

add StateFlow<T>.mapState, combineStates(StateFlow<T>...) - #317

Merged
hoc081098 merged 27 commits into
masterfrom
stateflows
Aug 16, 2026
Merged

add StateFlow<T>.mapState, combineStates(StateFlow<T>...)#317
hoc081098 merged 27 commits into
masterfrom
stateflows

Conversation

@hoc081098

@hoc081098 hoc081098 commented Dec 8, 2024

Copy link
Copy Markdown
Owner

Status

READY/IN DEVELOPMENT/HOLD

Breaking Changes

YES | NO

Description

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

Requirements

  • Dump api
  • Update README
  • Update CHANGELOG
  • Add tests
  • Add docs

@hoc081098 hoc081098 added the enhancement New feature or request label Dec 8, 2024
@hoc081098 hoc081098 self-assigned this Dec 8, 2024
@codecov

codecov Bot commented Dec 8, 2024

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.56115% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.43%. Comparing base (d56dfe0) to head (cb4a660).

Files with missing lines Patch % Lines
...monMain/kotlin/com/hoc081098/flowext/StateFlows.kt 98.56% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #317      +/-   ##
==========================================
+ Coverage   87.79%   89.43%   +1.64%     
==========================================
  Files          37       38       +1     
  Lines         770      909     +139     
  Branches      107      107              
==========================================
+ Hits          676      813     +137     
- Misses         53       55       +2     
  Partials       41       41              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hoc081098
hoc081098 requested a review from Copilot August 30, 2025 14:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds new StateFlow utility functions to the FlowExt library, providing convenient methods for mapping and combining StateFlow instances while preserving their state characteristics.

  • Adds StateFlow<T>.mapState() extension function for transforming StateFlow values
  • Adds combineStates() functions with 2-12 parameter overloads for combining multiple StateFlows
  • Includes comprehensive test coverage and API documentation

Reviewed Changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt New file implementing mapState and combineStates functions with internal StateFlow implementations
src/commonTest/kotlin/com/hoc081098/flowext/MapStateTest.kt Test file covering mapState functionality and readonly state flow validation
src/commonTest/kotlin/com/hoc081098/flowext/utils/BaseTest.kt Added helper function for validating readonly StateFlow instances
api/FlowExt.api Updated API dump reflecting new public functions
api/FlowExt.klib.api Updated Kotlin library API dump
Files not reviewed (2)
  • .idea/misc.xml: Language not supported
  • .idea/vcs.xml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt
Comment thread src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt
Comment thread src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt
Comment thread src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt
Comment thread src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt
Comment thread src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt
Comment thread src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt
Comment thread src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt
Comment thread src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt
Comment thread src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt
@hoc081098

Copy link
Copy Markdown
Owner Author

@codex review code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment thread src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt
@hoc081098
hoc081098 requested a balanced review from Copilot August 9, 2026 13:58
@hoc081098

Copy link
Copy Markdown
Owner Author

@codex review PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 7 changed files in this pull request and generated no new comments.

Files not reviewed (2)
  • .idea/misc.xml: Generated file
  • .idea/vcs.xml: Generated file
Suppressed comments (14)

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:54

  • Remove the duplicated period at the end of this sentence.
 * Combine two [StateFlow]s into a new read-only [StateFlow] with the given [transform] function..

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:75

  • Remove the duplicated period at the end of this sentence.
 * Combine three [StateFlow]s into a new read-only [StateFlow] with the given [transform] function..

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:97

  • Remove the duplicated period at the end of this sentence.
 * Combine four [StateFlow]s into a new read-only [StateFlow] with the given [transform] function..

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:120

  • Remove the duplicated period at the end of this sentence.
 * Combine five [StateFlow]s into a new read-only [StateFlow] with the given [transform] function..

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:144

  • Remove the duplicated period at the end of this sentence.
 * Combine six [StateFlow]s into a new read-only [StateFlow] with the given [transform] function..

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:178

  • Remove the duplicated period at the end of this sentence.
 * Combine seven [StateFlow]s into a new read-only [StateFlow] with the given [transform] function..

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:214

  • Remove the duplicated period at the end of this sentence.
 * Combine eight [StateFlow]s into a new read-only [StateFlow] with the given [transform] function..

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:252

  • Remove the duplicated period at the end of this sentence.
 * Combine nine [StateFlow]s into a new read-only [StateFlow] with the given [transform] function..

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:292

  • Remove the duplicated period at the end of this sentence.
 * Combine ten [StateFlow]s into a new read-only [StateFlow] with the given [transform] function..

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:336

  • Remove the duplicated period at the end of this sentence.
 * Combine eleven [StateFlow]s into a new read-only [StateFlow] with the given [transform] function..

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:382

  • Remove the duplicated period at the end of this sentence.
 * Combine twelve [StateFlow]s into a new read-only [StateFlow] with the given [transform] function..

src/commonMain/kotlin/com/hoc081098/flowext/StateFlows.kt:64

  • The entire combineStates overload family is untested, including collection behavior, equality conflation, live value reads, and the 6–12 argument paths that use the project's custom combine overloads. Please add coverage comparable to CombineTest.kt:38-218; otherwise regressions in these eleven new public APIs will not be detected.
public fun <T1, T2, R> combineStates(

.idea/vcs.xml:8

  • This duplicates both inspection entries already present immediately before/after these lines. Duplicate inspection IDs can make IDEA profile loading ambiguous; remove the two added copies.
    .idea/misc.xml:4
  • This changes the IDE SDK/language level to 21 while the repository explicitly standardizes on JDK 17 in build.gradle.kts:52-55 and .github/workflows/build.yml:27-32. Keep the project metadata aligned so contributors do not need a differently named SDK or accidentally use Java 21 features unsupported by the configured toolchain.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 0fe9f7c00d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ca346fcc5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .idea/misc.xml Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 24bb0fa328

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .idea/misc.xml Outdated
@hoc081098
hoc081098 merged commit 07d6f65 into master Aug 16, 2026
@hoc081098
hoc081098 deleted the stateflows branch August 16, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants