https://kotlinlang.org logo
Join SlackCommunities
Powered by
# redux
  • b

    babel

    05/27/2021, 7:39 PM
    Does anyone have experience adding async features to the Store via coroutines? We have some calls to dispatch coming from a coroutine living in a fragment lifecycleScope, if the developer called dispatch and navigate to a different fragment, the dispatch call gets cut short. My thought was to offer a new dispatchAsync method using the application scope so it outlives the fragment scope, and then from the Store, for safety, the store calls back to the subscribers with a new launch to default back to the main thread, as most of the subscribers are assuming they are being called on Main.
    b
    • 2
    • 5
  • j

    Jad Doueik

    06/07/2021, 5:22 AM
    Hello all, I am new to redux-kotlin and I facing a problem, I am unable to import redux functions to create and initialize the store please any help would be appreciated, the error I am having is "Unresolved reference: reduxkotlin"
  • z

    zalewski.se

    07/01/2021, 5:35 PM
    @Patrick Jackson Any plans to update to latest Kotlin version?
    p
    • 2
    • 1
  • w

    William Persall

    09/08/2021, 7:40 PM
    I am creating a store val mystery = store( reducerFun, MySpace, rEnhancer( )) Fun reducerFun = { state: some Classic, action:RAction -> ......} When I run this, and check in the browser dev tools. There is an issue in Kotlin-redux.js line 30 closure$reducer(state,action.action) that mismatch type action.action is not a function. Looking through action.action is of type RAction which is not a function. Am I declaring things incorrectly?
    p
    • 2
    • 1
  • p

    Patrick Jackson

    12/14/2021, 6:34 PM
    @channel anyone interested in contributing to reduxkotlin? I haven't had time in past year to do much (switching jobs, moving across country). Would really like to get updated to kotlin 1.6, which should be straight forward
    b
    • 2
    • 4
  • r

    Robert Jaros

    12/14/2021, 6:41 PM
    Is there any need to upgrade? It seems to work fine with 1.6.10 for me.
    p
    • 2
    • 1
  • r

    Robert Jaros

    12/14/2021, 6:42 PM
    But I'm using only JS target.
  • b

    Big Chungus

    12/20/2021, 6:38 PM
    https://github.com/reduxkotlin/redux-kotlin/pull/94
    K 1
  • a

    Alexander Black

    01/08/2022, 5:35 AM
    Are there any good examples of how I could make all of my redux interactions happen on a background thread except for subscriptions for the UI? I would ideally like to be able to do reducer and async actions all on a background thread, so as to not slowdown my UI, but sadly I have not found many resources on this topic. Seems that most examples I've seen do everything on the main thread, which is fine until it comes to IO stuff like network requests/db requests.
    b
    • 2
    • 5
  • a

    Alexander Black

    01/08/2022, 5:38 AM
    I wrote a middleware like this for async actions:
    Copy code
    override fun invoke(store: Store<AppState>): (next: Dispatcher) -> (action: Any) -> Any {
            return { next ->
                { action ->
    
                    if (action is Request) coroutineScope.launch {
                        action.execute(store.getState, store.dispatch, api, db)
                    }
    
                    next(action)
    
                }
            }
        }
    but the problem is that the state can get very out of wack in this situation if the coroutineScope is not on the same thread as the rest of the store. which in my case does not work out well.
  • a

    Alexander Black

    01/08/2022, 5:39 AM
    I've written another hacky solution at one point where I had my Request action return a flow of other actions which would allow me to process them sequentially, but that felt like a really weird solution.
  • d

    Dan Nesfeder

    02/01/2022, 9:45 PM
    Hey y'all 👋 ran into some build issues earlier today with a KMM project + redux running on Apple silicon https://github.com/reduxkotlin/redux-kotlin/issues/96 Is this a valid issue? Happy to close if not. Also willing to look into this and contribute if I'm in the ballpark here. Was looking at https://github.com/ktorio/ktor/pull/2664/files as a reference but no idea if that's what's needed here.
    b
    • 2
    • 7
  • j

    Joakim Forslund

    03/03/2022, 11:46 AM
    For https://reduxkotlin.org
    Copy code
    fun subscribe(onChanged: (AppState) -> Unit):StoreSubscription {
        return store.subscribe { onChanged(store.state) }
    }
    What would be the easieast way to make this more generic to listen to a specific state rather than the appstate? Obviously making each state inherit from a base class or interface is one way, but is there a more functional way?
    a
    e
    • 3
    • 5
  • k

    Kata

    04/22/2022, 1:19 PM
    I have an issue with my reducer in redux. When I copy a state sometimes I get an exception:
    Failed to allocate a 96 byte allocation with 3865072 free bytes and 3774KB until OOM, target footprint 536870912, growth limit 536870912; giving up on allocation because <1% of heap free after GC.
    Any idea what could be causing the issue? My guess is that maybe my reducer is called too often and that is causing the issue. I am using the copy() function of the data class.
  • p

    Philipp Nowak

    05/30/2022, 2:11 PM
    Hi guys, GitHub says there currently is a 0.5.6 with some improvements for threadsafe stores. It doesn't seem to be on MavenCentral yet, right? Any chance to get it there, since the release was already back in October 2021?
    e
    p
    • 3
    • 3
  • p

    Patrick Jackson

    08/27/2022, 12:53 AM
    Re: why is state not passed to subscribers? This has come up several times by various people. The answer had always been "because js redux does it this way" & the state is available easily through store.state. I've recently been doing some optimizations and found there could be good reason to pass the state for redux-kotlin. Reason being 'sychronized'. Chances are your using synchronized store for thread safety. This carries overhead of obtaining locks, so each call to store.state is getting a lock. If each subscriber does this it adds up! For my current project I'm using a store enhancer that does some custom subscription management and a custom callback that contains the new state so we avoid this problem. Curious if anyone does similar, or noticed the get state overhead. I'm tempted to change the core lib. It's a small change, but existing code bases may need to updated and we loose the 1:1 API matching with JS redux (which is probabaly does matter much at all). Thoughts?
    r
    b
    • 3
    • 2
  • p

    Przemysław Niemiec

    10/21/2022, 7:53 AM
    How to properly cancel coroutine job within thunk/middleware? E.g. we navigate to screen A -> fetching data (it takes 3 seconds) -> before fetching is finished we navigate back
  • v

    Ville Peurala

    11/01/2022, 12:04 PM
    Hmm, could this TODO be someday completed? https://reduxkotlin.org/basics/data-flow#next-steps
  • h

    humblehacker

    11/08/2022, 4:04 PM
    Can anyone give me an honest assessment of the viability of using ReduxKotlin in a new KMM app? It seems the main repo isn't maintained, but I did find @Emanuel Moecklin's fork which seems to be more current. What's the general feeling here about the future of this project?
    e
    b
    p
    • 4
    • 7
  • b

    Big Chungus

    01/13/2023, 4:24 PM
    https://oss.sonatype.org/content/repositories/snapshots/org/reduxkotlin/redux-kotlin-compose/0.1.0-SNAPSHOT/ is available for those wanting to try it out. Built with compose 1.3.0-rc2 and kotlin 1.8.0 Full release will come when compose 1.3.0 is out
    🎉 2
    🔥 1
    👍 1
  • b

    Big Chungus

    01/16/2023, 10:45 PM
    https://oss.sonatype.org/content/repositories/snapshots/org/reduxkotlin/redux-kotlin/0.6.0-SNAPSHOT/ is available with all missing kotlin targets support, upgraded dependencies and proper android artefacts. Will publish full release once I close a few long-standing issues as well.
    🎉 2
    p
    a
    • 3
    • 2
  • b

    Big Chungus

    01/29/2023, 10:52 PM
    redux-kotlin@0.6.0 is now generally available. Key highlights of this release include: • Full KMP target set • Removal of deprecated
    wasm32
    target • New
    Typed
    entities and converters between them Enjoy!
    🔥 2
    🎉 2
  • b

    Big Chungus

    01/29/2023, 11:27 PM
    redux-kotlin-thunk@0.6.0 follows suite with most of the same improvements as the core module.
    presenter
    and new
    compose
    modules will come later this month.
    🎉 4
  • r

    Robert Jaros

    01/31/2023, 10:00 AM
    ActionTypes
    interface has been changed from public to internal and KVision redux module no longer compiles. Not mentioned in the changelog.
    b
    • 2
    • 15
  • b

    Big Chungus

    02/03/2023, 2:09 AM
    redux-kotlin-compose@0.6.0 is live with compose 1.3.0 and kotlin 1.8.0
    🎉 4
  • j

    Joakim Forslund

    03/16/2023, 1:14 PM
    How do you guys handle coroutineScope (that respects lifecycle) in thunks or middlewares? Most interesting for me, would be to me would be to know how other people handle flows and collect from things like sqldelight or similiar where the result is later dispatched out.
  • a

    Andromadus Naruto

    03/16/2023, 3:05 PM
    Any plans to update the official docs for ReduxKotlin to reflect the latest version?
    b
    • 2
    • 3
  • i

    ianrumac

    04/06/2023, 9:42 AM
    Hey folks! I know most people here use the redux-kotlin lib, but since I like the uniflow pattern yet don’t like to be tied into the redux itself sometimes, I made Redukks - https://github.com/ianrumac/redukks. It’s made from a set of abstractions I’ve been reusing in projects for years, and since I got asked a lot about it after my talk, decided to push them up. It’s not opinionated, won’t force your views/viewmodels into some abstractions and keeps stores/actions separated, not bound together. It’s basically just providing a set of types, abstractions and some default implementations, so you can pick them up and build upon them. I’ve used this in both compose and fragment-based projects, both with dagger/hilt and without any DI at all. Would appreciate any comments/feedback ❤️
    🙌 2
  • j

    José Carlos

    10/27/2023, 12:58 PM
    Hey guys, it's my first time using Kotlin, i was wondering onde i defined my stores, how can i interact with the UI? How can i expose the state to the UI?
  • j

    José Carlos

    10/27/2023, 12:58 PM
    Once*