https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
redux
  • t

    tim

    04/10/2020, 9:49 AM
    Hi, I'm hoping you lovely people can help me out with my approach to updating state. I've been using data classes to represent State and the nested values on it, but I'm finding this cumbersome for some use cases, especially with nested data:
    state.copy(levelOne = levelOne.copy(levelTwo = levelTwo.copy( value = 0 )))
    which may not seem too bad here, but does get quiet verbose when I'm trying to update several values at two different 'paths'. Additionally I need to get/set values dynamically (think lodash's set/get functionality) i.e.,
    get<T>(state, "levelOne.levelTwo.value)
    and
    set(state, "levelOne.levelTwo.value", 1)
    . I should note my state is being serialised/deserialised to/from Firestore as a Map. To accomplish the above, I'm converting my hierarchy of data classes to a map (with nested maps) using jackson, and then implementing the set/get functionality on those maps, before converting back to the original State data class hierachy. But this seems needlessly complex. For example, I have to convert everything in the specified update path to a mutable structure, transverse the maps, and do lots of casting along the way. But, the benefit is that nested access is straightforward and my reducers are simple:
    reducer(state: State, action: FSA) {
       val payload = action.payload
       // I actually do this in my root reducer so i just mutate state directly here
       val fresh = state.copy()
       val oldValue = get<Int>("levelOne.levelTwo.value")
       set(fresh, "levelOne.levelTwo.value", 3 * oldValue)
       return fresh
    }
    I'm thinking one improvement I could do is implement something like immerjs where state is 'patched' in reducers and the patches are applied all at once before the root reducer finally returns the next state to minimise my converting to/from maps. The friction here stopping me from going to Maps altogether, is with data classes I get type safety when reading most values from state normally ...
    val some = tate.levelOne.levelTwo.value
    . Grateful for your thoughts/objections to the approaches above 🙏
    p
    s
    • 3
    • 12
  • r

    Robert Jaros

    05/12/2020, 10:34 PM
    Hello, Any chance to release JS artifacts compatible with new IR backend and Kotlin 1.4-M1?
    p
    • 2
    • 2
  • p

    Patrick Jackson

    05/22/2020, 2:27 PM
    @Buzz questions on what to work on in redux-kotlin thread
    b
    • 2
    • 9
  • z

    zalewski.se

    06/13/2020, 3:26 AM
    Is there a version of kotlin-redux compatible with Kotlin 1.4-M2?
    p
    • 2
    • 3
  • p

    Patrick Jackson

    06/14/2020, 12:47 PM
    ReduxKotlin v0.5.1 is available 🙂 • a thread-safe store • recommended way to create the store is now `createThreadSafeStore(reducer, state) • updated to Kotlin 1.3.72 • more info: • https://reduxkotlin.org/introduction/getting-started • https://reduxkotlin.org/introduction/threading
    g
    • 2
    • 1
  • r

    Robert Jaros

    06/14/2020, 1:50 PM
    is redux-kotlin-thunk 0.4.0 compatible with redux-kotlin 0.5.1 or do we need to wait for new release?
    p
    • 2
    • 3
  • b

    Big Chungus

    06/14/2020, 3:01 PM
    Which platforms is threadsafe artifact published for?
    p
    • 2
    • 7
  • a

    Andrew Steinmetz

    06/30/2020, 5:27 AM
    @Patrick Jackson I tried using the redux kotlin presenter middleware, but unfortunately couldn't get it to work in my project because it has javascript which I saw was commented out in that project due to coroutine support at the time of its creation. I tried pulling the repo to see if I could update any of it, but running into a lot of problems. Wondering if there is any plan to update that project to support other platforms like js? Or maybe some guidance on trying to support js for it?
    p
    • 2
    • 1
  • w

    willyrs

    07/03/2020, 6:02 PM
    Hi all! I’ve written a reducer function like this:
    val splashReducer: Reducer<SplashState> =  { state, action -> return state }
    and when I call it on iOS I have a EXC_BAD_ACCESS (code=1, address=0x0) error If I write the function like this:
    fun splashReducer(state: SplashState, action: Any) : SplashState { return state }
    it works! Do you think it’s a problem with reduxkotlin or with kotlin-native? P.S. On kotlin-android it works with both
    p
    • 2
    • 9
  • p

    Patrick Jackson

    07/04/2020, 1:35 AM
    ReduxKotlin v0.5.2 is out! This is a release with all platform artifacts published to maven central. No new features or bugfixes. CI/CD is setup!!! Automatic publishing to maven central for releases and snapshots. This is going to be a big help. Happy 4th of July! 🇺🇸
    👍 2
    r
    a
    • 3
    • 6
  • w

    willyrs

    07/13/2020, 4:40 PM
    is arm32 not avaiable? it gives me an error if I add that target.. does apple don’t want arm32 support anymore?
    p
    • 2
    • 3
  • s

    Samuel Bichsel

    07/22/2020, 3:37 PM
    Hey! We are trying to implement a project with the https://github.com/reduxkotlin/presenter-middleware. Unfortunately it is not compatible with the current version (see https://github.com/reduxkotlin/presenter-middleware/issues/3). We tried to downgrade all the other redux-kotlin dependencies, but unfortunately it breaks somewhere else with a similar error. We even tried to checkout the repo and fix it by ourself, but we didn’t get it running. Now after some hours of troubleshooting, we don’t know what to do anymore. Could anyone please help us with either support the store as a interface in the middleware or how to build and run the project and the module locally? Thanks alot!
    p
    • 2
    • 3
  • r

    Robert Jaros

    07/24/2020, 3:54 PM
    Any chance for Kotlin-1.4-M3 release?
    b
    p
    +2
    • 5
    • 54
  • a

    Archie

    07/29/2020, 3:25 PM
    Hi, I found
    Kotlin Redux
    a few days back and now Im starting to learn and study it. I understand the concepts very well but I just can't get how to model the
    AppState
    right. How exactly do you model the
    AppState
    ? Examples I've seen so far only show a small application where the
    AppState
    is very simple. But how do you model an
    AppState
    in a Large Application with multiple screens? Do I make smaller "`AppState`" inside the "root"
    AppState
    like:
    data class AppState(
        val loginAppState: LoginAppState,
        val signUpAppState: SignUpAppState
        val someOtherScreenAppState: OtherScreenAppState
        ....
    )
    
    data class LoginAppState(
        val usernamer: String,
        val password: String
        ....
    )
    It seems that 
    Redux
     makes sense when screens share state between screens such as the Todo Application Example or its very simple when dealing with single screen application such as the Counter Application but how do you model the 
    AppState
     when working with screens doesn't really have connected state such as an application with a 
    LoginScreen
     and 
    SignUpScreen
    . Those two screens doesn't share any state. How to deal with these kinds of scenarios? I'd really appreciate any help. Thank you very much in advance
    w
    g
    p
    • 4
    • 24
  • a

    Archie

    08/26/2020, 3:02 PM
    how do you trigger navigation in Redux? Is navigation also part of the AppState in Redux? If so does that mean I also have to have a reducer specifically for navigation?
    p
    • 2
    • 1
  • m

    Mark Iantorno

    08/30/2020, 6:42 PM
    Any help would be greatly appreciated
    p
    r
    • 3
    • 22
  • c

    Corey Lanier

    09/29/2020, 9:46 PM
    Yes. I wound up figuring it out, but there’s a lot of spots in this tutorial where it gets you nearly there without connecting the dots properly. Left me frustrated.
    p
    j
    • 3
    • 8
  • d

    Denis Ismailaj

    10/24/2020, 9:39 PM
    Any plan to update MovieSwiftUI-Kotlin’s Compose part?
    p
    • 2
    • 1
  • w

    willyrs

    01/29/2021, 12:55 PM
    Hey all, I have lots of actions going on when my mobile app launches, I was wondering if there's a way to Throttle the store subscription and reduce the number of re-render triggered
    p
    • 2
    • 6
  • b

    Brian Odisho

    05/26/2021, 10:30 PM
    Hey all, I’ve added a logging middleware that logs the action and the next state to the end of my middleware chain. This logs the action right before it makes it to the reducer however because middlewares can modify an action I can’t guarantee that the action being logged was the original action that was dispatched.  My initial thoughts were to add a log middleware to the beginning of the middleware chain in addition to the end of the chain but I’m concerned about spamming logs since we dispatch so many actions.  Does anyone have any thoughts or feedback on this?
    b
    p
    • 3
    • 5
  • 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
  • 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
  • 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
  • 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
    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
  • 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
Powered by Linen
Title
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

Robert Jaros

08/27/2022, 6:32 AM
KVision wrapper for ReduxKotlin (and Redux.js as well) uses callback with new state value. Just for convenience (JS runtime is single-threaded anyway, so synchronization is not an issue).
b

Big Chungus

08/27/2022, 6:55 AM
I think this would be a great addition. I always hated that in redux.js. It made writing middleware really annoying
View count: 1