Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
1.2.0 source code.tar.gz | 2023-07-28 | 270.0 kB | |
1.2.0 source code.zip | 2023-07-28 | 348.3 kB | |
README.md | 2023-07-28 | 2.0 kB | |
Totals: 3 Items | 620.4 kB | 0 |
DSL additions
-
Added new
condition
block that allows specifying additional condition for a state. The block supports all the same methods thatinState
supports. ```kotlin spec { inState<MyState> { // general onEnter/onAction/... methodscondition({ state -> state.value == "condition" }) { // onEnter/onAction/... methods that will only be triggered when the condition is true } } }
- Added new `untilIdentityChanges` block. This allows to give a state object an identity like an id and will re-trigger anything running in that block whenever the identity changes.
kotlin spec { inState<MyState> { // general onEnter/onAction/... methodsuntilIdentityChanges({ state -> state.searchQuery }) { // triggered whenever
searchQuery
changes onEnterEffect { state -> sendAnalyticsEvent(state.searchQuery) }// whenever `searchQuery` changes the collection is stopped and a new flow is built and collected collectWhileInState({ state -> loadSearchResults(state.searchQuery )}) { result, state -> // update state based on result }
} } } ```
Internal re-write
- The internals of FlowRedux have been completely rewritten and simplified. The library behavior is now much more consistent and predictable.
- Cancellation of a running block like
collectWhileInState
is now guaranteed to happen before anything in the new state starts.
Other changes
- The
collectWhileInState
method that has a lambda parameter to build the collectedFlow
. now receivesS
instead ofFlow<S>
as its parameter. - The compose artifact now a multiplatform library with support for all platform supported by compose-multiplatform.
Deprecations
inState
withadditionalIsInState
has been deprecated in favor of thecondition
block.inStateWithCondition
has been deprecated in favor of thecondition
block.