https://kotlinlang.org logo
Docs
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
  • r

    Robert Jaros

    08/05/2019, 6:56 AM
    perhaps you could change
    dispatch
    in
    Thunk
    to
    operator invoke
    p
    • 2
    • 1
  • a

    andreworobator

    08/28/2019, 12:59 PM
    Going through the tests for redux-kotlin and I’m not sure how useful this one is https://github.com/reduxkotlin/redux-kotlin/blob/2613d836aebf8195a88dbb3ed19f296358e0b572/lib/src/test/kotlin/org/reduxkotlin/ApplyMiddlewareTest.kt#L13
    p
    • 2
    • 3
  • p

    Patrick Jackson

    08/28/2019, 2:15 PM
    yes, I think that would work. I tried that for awhile and didn't find it too useful, but if your breaking it down by screen that may be beneficial to make sure all the actions are handled. These helper function would make it easy to declared a "sealedReducer" :
    typealias SealedReducer<TState, TAction> = (state: TState, action: TAction) -> TState
    typealias SealedReducer<TState, TAction> = (state: TState, action: TAction) -> TState
    
    inline fun <TState, reified TAction> sealedReducer(crossinline reducer: SealedReducer<TState, TAction>): Reducer<TState> {
        return {state, action ->
            if (action is TAction) {
                reducer(state, action)
            } else {
                state
            }
        }
    }
    sealed class LoginScreenAction
    class LoginButtonTap: LoginScreenAction()
    
    val loginScreenReducer = sealedReducer<TestState, LoginScreenAction> { state, action ->
        when(action) {
            is LoginButtonTap -> state
        }
    }
    • 1
    • 1
  • a

    andreworobator

    08/28/2019, 2:25 PM
    Cool, cool. Do you recommend just having 1 top level reducer? I can imagine it getting quite large. Would an AppStore and a FeatureStore make sense if you wanted to go multi-module and break things up?
    p
    • 2
    • 1
  • a

    andreworobator

    08/28/2019, 5:24 PM
    The intended guarantee is that Redux eventually calls all subscribers with the most recent state available, but not that it always calls each subscriber for each action. The store state is available in the subscriber simply by calling store.getState()
    This explanation is more about disallowing the action in the subscriber which i totally get and support. but having the most recent state in the subscriber could be easily solved with
    (State) -> Unit
    and you could eliminate a whole class of bugs
    🤔 1
    p
    r
    p
    • 4
    • 5
  • a

    andreworobator

    08/28/2019, 7:40 PM
    If that's a requirement, i would make thread confinement enforced by the library, just like Android enforces not accessing UI on the main thread. The critical block is probably with subscribe and dispatch. If you have multi-threaded subscribes, that changes the list of listeners, not necessarily all of them got in the list. Then if you dispatched, the
    listeners.forEach
    could have listeners mutated right in the middle of the loop which would be weird
    p
    • 2
    • 6
  • b

    Big Chungus

    09/09/2019, 12:11 PM
    How do i pass an extra argument when dispatching a thunk?
    p
    • 2
    • 1
  • a

    andreworobator

    09/19/2019, 10:31 PM
    left some comments
    p
    p
    • 3
    • 2
  • p

    Patrick Jackson

    09/22/2019, 4:28 PM
    PR up for the website! https://github.com/reduxkotlin/redux-kotlin/pull/21 Going to be more tweaks before publishing. Interested in feedback.
    a
    • 2
    • 5
  • a

    andreworobator

    09/23/2019, 12:10 AM
    @Patrick Jackson Going forward, I’d recommend putting visual guidelines in the IDE for at least 100 chars. I generally like to break documentation at 80 which is the reason for the 2nd visual guide.
    p
    • 2
    • 1
  • a

    andreworobator

    09/23/2019, 1:47 AM
    There should be a guide on testing in these docs. i imagine the testing strategy would be to unit test the reducers?
    p
    • 2
    • 1
  • b

    Big Chungus

    09/26/2019, 12:34 PM
    Essentially an interchangeble for kotlin-react-redux
    p
    • 2
    • 3
  • a

    andreworobator

    10/23/2019, 7:21 PM
    Seems like compose would play pretty nicely with redux https://developer.android.com/jetpack/compose
    p
    • 2
    • 1
  • g

    Guillermo Robles

    12/09/2019, 9:47 PM
    Hi channel, I am wonder which is best practice, to have a unique store for the entire app or different stores for each activity(in case of android)?
    p
    r
    • 3
    • 5
  • n

    Nikky

    12/12/2019, 2:50 PM
    is there any implementation of redux that is multiplatform? i hav the crazy idea to seralize the actions and send them between server and client is there such a thing yet ?
    b
    p
    • 3
    • 12
  • n

    Nikky

    12/12/2019, 4:41 PM
    so.. i am planning to use redux to store the state of a boardgame (figure positions mostly) 1. what is the correct way for a reducer to fail ? eg. from a illegal action by the player 2. is it a smart idea to serialize the actions and have the client send to the server ? 3. assuming thats not a stupid idea.. can i hook up the store to autmatically send any changes via network (ktor and websocket)
    r
    • 2
    • 4
  • n

    Nikky

    12/12/2019, 10:39 PM
    otherwise.. what are the artifacts for the platforms ?
    p
    • 2
    • 2
  • n

    Nikky

    12/13/2019, 3:37 PM
    is there any smart solution for subscribers that want to process things added or removed from list / maps ? currently i keep a old copy and compare, i am pretty sure there gotta be a better approach
    p
    • 2
    • 2
  • n

    Nikky

    12/15/2019, 9:35 AM
    do i then still need to care about unsubscribing ? and what do i call for that ?
    p
    • 2
    • 1
  • n

    Nikky

    12/20/2019, 8:11 PM
    since the api is so close to reduxjs.. is there any code on kotlinJs to cast stuff to a kotlin-wrappers redux backed by reduxjs ?
    p
    • 2
    • 3
  • b

    Big Chungus

    12/30/2019, 10:47 AM
    How do i switch to store thread in common module with coroutines?
    p
    • 2
    • 1
  • n

    Nikky

    01/04/2020, 4:20 PM
    is there any contract stating that dispatch has to return the transformed state ? because to me the
    redux.Store
    api looks like it could return anything
    p
    • 2
    • 2
  • n

    Nikky

    01/06/2020, 2:10 PM
    when using kotlin-redux on js is there any point in adding a line like that ?
    js("if(window.__REDUX_DEVTOOLS_EXTENSION__ )window.__REDUX_DEVTOOLS_EXTENSION__ ();else(function(f){return f;});")
    https://github.com/lawik123/kotlin-poc-frontend-react-redux/blob/44eceb985a6871a2c13e6c5487777d55acf64bfb/src/main/kotlin/nl/lawik/poc/frontend/reactredux/Index.kt#L17
    p
    • 2
    • 3
  • b

    Big Chungus

    01/12/2020, 9:38 AM
    Getting the following on windows:
    Could not find org.reduxkotlin:lib-win:0.3.1.
    Searched in the following locations:
      - <https://jcenter.bintray.com/org/reduxkotlin/lib-win/0.3.1/lib-win-0.3.1.pom>
      - <https://repo.maven.apache.org/maven2/org/reduxkotlin/lib-win/0.3.1/lib-win-0.3.1.pom>
      - file:/C:/Users/mpetuska/.m2/repository/org/reduxkotlin/lib-win/0.3.1/lib-win-0.3.1.pom
      - <https://kotlin.bintray.com/kotlin-js-wrappers/org/reduxkotlin/lib-win/0.3.1/lib-win-0.3.1.pom>
      - <https://dl.bintray.com/kotlin/kotlinx.html/org/reduxkotlin/lib-win/0.3.1/lib-win-0.3.1.pom>
    Am I missing something?
    p
    p
    • 3
    • 7
  • b

    Big Chungus

    01/12/2020, 12:51 PM
    Anyone tried to use reduxkotlin on native? I keep getting
    kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlin.native.internal.Ref
    when trying to createStore
    p
    p
    • 3
    • 3
  • n

    Nikky

    02/06/2020, 9:07 PM
    i have no idea how i did not run into this before..
    java.lang.IllegalStateException: You may not call the store from a thread other than the thread on which it was created.
    but how would be the easiest way to lets say.. make sure that this does not happen by using the same thread / coroutine context ?
    c
    p
    t
    • 4
    • 9
  • t

    tim

    02/28/2020, 2:34 PM
    Hey folks how are others storing their state? For example, are you using a
    data class
    , a Map, or something else entirely? I'm coming from the JS/TS ecosystem where libraries like ReduxToolkit/Immutable.JS make this a straightforward decision but I'm curious what 'best practice' looks like here in kotlin-land 🙏 In my first attempt I'm using data classes but finding that only 1 or 2 layers of nesting starts to cause issues in my reducers. So i could either go with Maps and forget data classes or reduce the nesting... or perhaps theres a better way altogether?
    b
    • 2
    • 5
  • b

    Big Chungus

    03/23/2020, 9:32 PM
    Any ETA on when reduxkotlin will be published for windows? v0.4.0 still does not resolve windows artefact
    p
    • 2
    • 3
  • p

    Patrick Jackson

    03/24/2020, 1:30 PM
    Redux-Kotlin v0.4.0 is available! This updates to kotlin 1.3.70. Redux-kotlin-thunk is also updated to v0.4.0. Thunk has a breaking change where thunks are now a typealias, rather than an interface. Kotlin 1.3.70 fixed a bug that allows use of typealias and closer match to JS thunk api.
    👍 1
    • 1
    • 1
  • r

    Robert Jaros

    03/24/2020, 2:05 PM
    It's already 1.3.71 available
    p
    • 2
    • 1
Powered by Linen
Title
r

Robert Jaros

03/24/2020, 2:05 PM
It's already 1.3.71 available
p

Patrick Jackson

03/24/2020, 2:11 PM
yep! will prob do a 0.4.1 update for that. I haven't checked, but I image redux-kotlin 0.4.0 will work with kotlin 1.3.71
View count: 4