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
squarelibraries
  • j

    jw

    11/12/2022, 3:29 AM
    Compose's very first recomposition runs synchronously. If you are using
    launchMolecule
    by the time you get the
    StateFlow
    returned a single recomposition has run. If you are using
    moleculeFlow
    then it will emit immediately, although i'm not sure if that involves posting to the dispatcher or not.
    a
    c
    • 3
    • 19
  • a

    Aaron Todd

    11/14/2022, 9:34 PM
    Is there a way to mark a connection as "should not be re-used" in okhttp?
  • j

    jessewilson

    11/14/2022, 9:58 PM
    Add a header,
    Connection: close
  • j

    jessewilson

    11/14/2022, 9:58 PM
    Either on the request or the response, and it can be in an interceptor
    a
    • 2
    • 1
  • t

    Tadeas Kriz

    11/14/2022, 10:43 PM
    Do you have a timeline for https://github.com/cashapp/zipline/issues/745 and https://github.com/cashapp/redwood/issues/404? Thank you! 🙂
  • j

    jw

    11/14/2022, 11:02 PM
    The latter is done, just blocked on the former
  • a

    Aaron Todd

    11/15/2022, 4:03 PM
    Does okhttp have a way of limiting the maximum number of connections used? I see ConnectionPool allows configuring
    maxIdleConnections
    but says nothing of maximum total connections allowed to be created/active. I also am not seeing an equivalent of a
    connectAcquireTimeout
    ...
    j
    • 2
    • 17
  • e

    eygraber

    11/16/2022, 6:46 AM
    Is it fair to say that https://github.com/cashapp/redwood/issues/380 is a fundamental issue with Redwood currently (at least with a Compose UI frontend)? A simple fix would be to update
    text
    directly in the
    onValueChange
    callback, but that's now explicitly creating multiple sources of truth (which may be better than the current implicit multiple sources of truth, but is still not great). I haven't played around much with Redwood other than with the samples, so I'm not sure if this is an isolated issue with
    TextField
    because
    onValueChange
    can be called OOB (because of IME, etc...), or if there are problems with other composables as well. In any case, having to handle it for even just
    TextField
    seems like a high burden to someone using Redwood.
  • j

    jw

    11/16/2022, 10:32 AM
    It's not really an issue. More just the cost of doing business.
  • m

    Marc Plano-Lesay

    11/16/2022, 12:05 PM
    This sounds like a fairly similar concept as Workflow's
    TextController
    , which is required for "legacy" views as well, not just Compose, for what it's worth. Ensuring a single source of truth for text inputs is inherently tricky.
  • e

    eygraber

    11/16/2022, 4:09 PM
    Right, I meant issue more as something that has to be dealt with rather than Redwood being broken. I can see this being a typical flow when someone tries to adopt Redwood (at least it was my experience 😅): 1. Start using Redwood with Compose UI 2. Provide a text field implementation with simple mutable state handling like they're used to in Compose UI 3. Scratch their head when the TextField only allows one character to be typed 4. Either give up and assume Redwood is broken (because it works fine in Compose UI) or spend hours debugging until they figure out what's going on 5. Figure out the problem, come up with the solution, implement it Is the plan to have Redwood provide something like
    TextController
    /
    TextFieldState
    and put a disclaimer in the readme that this is how text needs to be handled? While in practice this might only affect text, in theory couldn't this affect any component where the value is provided from a callback?
  • t

    Tadeas Kriz

    11/16/2022, 10:23 PM
    Is there a way to have layout modifiers in Redwood without specifying a scope so they could be applied to any item?
  • j

    jw

    11/16/2022, 10:28 PM
    We removed this ability recently. What's your use case?
  • t

    Tadeas Kriz

    11/16/2022, 10:29 PM
    I want to have some modifiers that are available to any widget. For example the
    Modifier.padding
    in Compose UI is a freestanding modifier that's not scope-specific. One other thing I wanted to try implementing was
    Modifier.clickable
    , but I wasn't sure it that'd work at all
  • j

    jw

    11/16/2022, 10:34 PM
    I'm not at a computer, but our general usage has been for components that are much higher level where things like padding and the ability to be clicked are properties and not modifiers. Our modifiers are named layout modifiers because they're only meant to be read by the parent layout such as to set things like alignment
  • t

    Tadeas Kriz

    11/16/2022, 10:36 PM
    I see. Thanks for that context. It's true that I'm really misusing Redwood and so it makes sense that this usecase doesn't align well. Thanks anyway! 🙂
  • j

    jw

    11/16/2022, 10:36 PM
    You could create your own Modifier type and add all those things to it
  • t

    Tadeas Kriz

    11/16/2022, 10:39 PM
    That's a good idea, I'll try exploring that, thanks!
  • s

    Stylianos Gakis

    11/16/2022, 10:46 PM
    Is there any place where one could see at examples to be inspired as to how “high level” are we talking when you say that? I’d imagine a lot of people will default to designing granular enough components where things like “padding” are needed, potentially falling into a trap that wouldn’t be so good in the long run. If you got any learnings like that while using redwood internally, I’m sure it’d be very valuable to share to the outside world to avoid doing the same mistakes if that makes sense.
  • j

    jw

    11/16/2022, 10:50 PM
    Jesse talks about that in the Droidcon NYC presentation. Ultimately it is up to you at what granularity you design, but our intent was to encode our design system components as defined by our design team. They are usually similar to regular widgets (like a Button) but where all the design choices are already made and so you're only deciding between things like primary or secondary style.
  • j

    jw

    11/16/2022, 10:50 PM
    We don't really have anything beyond that right now
  • s

    Stylianos Gakis

    11/16/2022, 10:56 PM
    Yeah I see your point of view, makes sense. Looking forward to hearing more from other teams that try out redwood. Maybe they also end up defaulting to what you’re describing here.
  • l

    Landry Norris

    11/17/2022, 2:03 PM
    When using paparazzi, is there a good way to run the composables without recording a snapshot? I have a composable that takes a couple of frames to perform an incremental layout process. I want to test that it’s properly laid out in 5 ticks, but I don’t quite care what happens for the first 4. I’m currently passing names ‘frame$i’ as names for the snapshots, but if I make improvements and it can finish in fewer ticks, I don’t want tests to flag it. I really only care that the 5th tick looks right.
  • d

    dave08

    11/20/2022, 1:16 PM
    Is it possible to use a Molecule function to manage the updating of some status on each item of a list (probably by passing down some kind of provider of composable functions that give a statelflow unique to each item)...?
  • d

    dave08

    11/20/2022, 1:19 PM
    I'm wondering if it somehow integrates into the recomposition tree of the UI so that when the LazyList puts other items there, then it stops listening to that stateflow and creates a new one, maybe that's the whole point of Molecule? (I've never really used it, I'm just trying to see if it could help solve our use case...)
  • d

    dave08

    11/20/2022, 3:56 PM
    Giving it a try now... but I'm getting an error in Android Studio that flow operators shouldn't be used in composables... will I have to do
    @SuppressLint("FlowOperatorInvokedInComposition")
    for each of them? It seems to me that in the context of Molecule presenters there's no real problem in transforming/filtering flows... maybe there's a way for the library to suppress those warnings for it's functions somehow?
    h
    j
    • 3
    • 13
  • d

    dave08

    11/21/2022, 4:07 PM
    Should I create a new
    MainScope()
    in my
    ViewModel
    for
    launchMolecule()
    ? It seems like
    viewModelScope
    doesn't work...
  • d

    dave08

    11/21/2022, 4:08 PM
    I don't think there's any healthy way to pass the `Activity`'s scope there, and I would really like to keep all this code in the view model...
  • d

    dave08

    11/21/2022, 4:11 PM
    Nope... still gives me a
    java.lang.IllegalStateException: A MonotonicFrameClock is not available in this CoroutineContext. Callers should supply an appropriate MonotonicFrameClock using withContext.
    error...
  • d

    dave08

    11/21/2022, 4:12 PM
    And the sample doesn't seem to show how to use Molecule from a ViewModel either...
Powered by Linen
Title
d

dave08

11/21/2022, 4:12 PM
And the sample doesn't seem to show how to use Molecule from a ViewModel either...
View count: 8