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
apollo-kotlin
  • m

    Marco Pierucci

    11/24/2022, 2:48 PM
    Hello everyone! We are going to start internationalising our app and we've selected the variant per country approach. Each variant will point to a backend instance which will have its own schema ( which will have similar types and custom per country types), If I understood correctly I could use
    createAllAndroidVariantServices
    so each variants will have their corresponding generated code, which is good. It seems though than when mapping to a domain layer I'd have to replicate mappers for the shared components ( one mapper that target each variant source code) which its a bit tedious. Has someone faced a similar scenario and could share maybe a better solution/ approach ?
    b
    • 2
    • 6
  • j

    Jan Skrasek

    12/08/2022, 9:25 AM
    Hi, we have a custom Gradle convention plugin to pre-setup ApolloExtension. However, with compulsory service name definition, "later" we are unable to modify the plugins configuration in the actual gradle.kts file - as the service has to be defined at once. What is the solution here?
    b
    m
    • 3
    • 15
  • s

    Stylianos Gakis

    12/12/2022, 4:57 PM
    Got a question regarding apollo-kotlin and using an
    okhttp3.Authenticator
    with it. So my use case is as such. We use okhttp interceptors to append the Auth token on our requests, and an
    okhttp3.Authenticator
    to respond to 401s by refreshing token, retrying the request and so on. Thing is, apparently sometimes we get the 401 inside the graphql response with a 200 header so we can’t entirely rely on the
    okhttp3.Authenticator
    to check these not authorized cases, but we need an okhttp interceptor on top of it to catch those cases too. Is my best bet to simply use a
    com.apollographql.apollo3.interceptor.ApolloInterceptor
    , look at the response body for the 401 in the error codes, and do what my
    okhttp3.Authenticator
    would do? Is it weird that our backend responds with 200 but 401 in the error message itself? I also worry about concurrent access from both my
    okhttp3.Authenticator
    and my
    com.apollographql.apollo3.interceptor.ApolloInterceptor
    both trying to get the refresh token and create a new access token. I guess I’d also need to manage the concurrency by locking on whatever class they both access, instead of locking inside the two authenticators/interceptors themselves. Just asking here to see if I am going in the right direction or if I am missing something super obvious that would make my life easier 🤩
    m
    w
    • 3
    • 23
  • m

    Marco Pierucci

    12/14/2022, 2:46 PM
    👋 Sorry this might be a silly one, but Im trying to move to variant services for apollo kotlin. Im following the doc But Im getting a
    Could not set unknown property 'nameSuffix' for extension 'apollo'
    🤔
    m
    • 2
    • 19
  • s

    Spencer

    01/09/2023, 8:19 PM
    Hey all, I have a question about caching lists. If there is a filterable list, that returns a list of nodes, and we were to call a mutation that would add or remove a node from the list (or even pagination), how do we update the cache of the list? Or am I just thinking about this wrong? Example: • Let's say there is a searchable list of users, and with out search text the query returns the whole list. • But then we start to type in the search field and make a new query. • Then we call a mutation that deleted Bob Smith (or even added a new Bob Smith) I think the cache would look something like this:
    Account:12345.users()
    Account:12345.users({search: "Bob"})
    Account:12345.users({search: "Bob Smith"})
    The problem is that we want to update the cache for all the lists after the mutation succeeded. I have thought about updating the cache manually with
    writeOperation
    but we would run into not knowing every single search query text, or having to keep a list of every time a query was made with the search text. The same would apply trying to use refetch queries in the mutation collect, or even just deleting the cache key from the store with
    apollo.apolloStore.remove(CacheKey(key))
    .
    m
    • 2
    • 5
  • b

    bod

    01/17/2023, 9:56 AM
    Hello, World! :android-wave: We're are currently thinking of removing the idling resource in the next major version of the library as it seems to have become less of a good practice nowadays - see this comment from OkHttp for instance, and this article about how to avoid them with Compose. Any objections against this?
    s
    • 2
    • 2
  • r

    rocketraman

    01/19/2023, 7:51 PM
    My GraphQL server has a scalar type which converts to a list (ugh!). If I try to create a custom type mapping to
    "kotlin.List<kotlin.String>"
    I get an invalid character on
    <
    . Is there a way to have my custom type mapping be a list? If not, I'll create a wrapper type.
    m
    • 2
    • 7
  • d

    dorche

    01/20/2023, 10:50 PM
    My backend is sending Unauthorised wrapped in a 200 response and the actual error in the body. So in my AuthInterceptor I have to read the body to determine if I should refresh my token and re-do the original request. What is the correct way to read the body?
    HttpResponse.body
    returns BufferedSource and I am not sure how to read it without closing the stream. The json parsing itself is pretty simple so I am fine with manually parsing but I get an exception with my current code
    m
    s
    • 3
    • 29
  • a

    agrosner

    01/24/2023, 4:53 PM
    hey quick question in regards to the incubating cache artifacts for pagination support. Do you expect those to be mainlined at some point in the near future? Or should we continue proceeding at risk of changes?
    b
    • 2
    • 2
  • p

    Parijat Shah

    01/26/2023, 7:17 AM
    I am using OkhttpClient with ApolloClient ( version 3.7.4). When user switches profile, I close the ApolloClient
    close()
    and create new ApolloClient with the same OkHttpClient instance. But this is not working. None of the
    query
    or
    mutation
    operation result in any http request. ( Confirmed using charles) Everything works as expected if I don't call
    .close()
    . I need to call
    .close()
    to terminate subscriptions for the
    older
    profile and then create new subscriptions. Does anyone know what's happening under the hood when ApolloClient.
    close()
    is called?
    b
    • 2
    • 15
  • d

    dorche

    01/26/2023, 12:33 PM
    Hi everyone, I am running into a weird issue in regards to parsing (kinda continued from a couple message above).. My GraphQL schema defines the queries like
    type Query {
      games: [Games!]!
    }
    This results in a Response adapter with the following fromJson code
    public override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): GetGamesQuery.Data {
          var _games: List<GetGamesQuery.AllAccount>? = null
    
          while(true) {
            when (reader.selectName(RESPONSE_NAMES)) {
              0 -> _games = Games.obj().list().fromJson(reader, customScalarAdapters)
              else -> break
            }
          }
    
          return GetGamesQuery.Data(
            games = _games!!
          )
        }
    But when my server encounters a “GraphQL” when running this query, the response that it sends down fails to parse, details in 🧵
    b
    • 2
    • 7
  • r

    Ron Aharoni

    01/29/2023, 6:47 AM
    Hey all, I am writing an integration test for a service that contacts another service using graphql with apollo client. What is the best approach for mocking the service? Is a regular http mock server a reasonable approach? I’ll mention that the test is dockerized. Thanks!
    m
    • 2
    • 6
  • s

    Stylianos Gakis

    01/31/2023, 3:28 PM
    I have a thought that I’d like to hear opinions about. I know toFlow() exists, where you can simply call that instead of
    execute
    on an operation, since that’s what it does internally anyway. So at any query we could theoretically replace it with
    toFlow
    and assume all responses can return more results instead of just one (I think with deferred responses that’s was the idea) Now I have a screen in Android, where I was checking out removing all configuration changes, so I applied all of these and let compose handle all config changes (testing language changes here in my case). Thing is, for that screen I am testing, I realize we have one part of the screen which shows some string that comes from the backend as-is, meaning it takes what locale header we send it, and responds accordingly, while the other strings of the text are local, so they update immediately when we do a language change, which does not restart the activity, since the Apollo query isn’t re-fetched obviously. If I let the activity re-create itself I get that for free since the entire thing restarts from the beginning. So finally what I am wondering about. Is there any way I can somehow hook something into the apollo-client, so that if there is ever a locale change, I can ask it to re-fetch every flow it’s got open at the moment, where it will then fetch the correct locale since the interceptor will then get the correctly changed locale and append it in the HTTP headers? Does this idea even make sense conceptually? 😄
    m
    b
    • 3
    • 10
  • j

    John O'Reilly

    02/04/2023, 3:34 PM
    Sorry if this has been asked already but is there way to rename/alias a property in query/result?
    s
    • 2
    • 3
  • c

    Colton Idle

    02/07/2023, 12:35 AM
    first time working with apollo kotlin. trying to add apollo-kotlin to a new module i created. when i sync i get this error. Am I missing something fundamental here? Edit: fairly certain something is either wrong with apollo-kotlin or maven central?
    e
    b
    • 3
    • 30
  • c

    Colton Idle

    02/07/2023, 7:51 PM
    Continuing with yesterday. I'm trying to get a demo of graphql working. I'm following the "get started instructions" but I'm kinda confused at this part Don't I need to call that command with some sort of URL pointing to the schema?
    s
    b
    • 3
    • 2
  • c

    Colton Idle

    02/08/2023, 4:29 PM
    It's possible to use apollo3 and an older version of apollo in the same app, right?
    b
    m
    w
    • 4
    • 14
  • s

    Sean Proctor

    02/09/2023, 11:40 AM
    I'm trying to get Apollo working on a JS target. The same code on Android/JVM works fine, on JS it throws an exception "SubscriptionOperationException: Operation error <subscriptionName>". Is there anything JS-specific with subscriptions that I should know?
    b
    m
    • 3
    • 29
  • c

    Colton Idle

    02/09/2023, 3:12 PM
    In apollo3 should me schema and query look like this in the file tree? Or should I be moving it under a package? like src/main/graphql/com.example.myapp?
    b
    s
    +2
    • 5
    • 16
  • c

    Colton Idle

    02/10/2023, 3:09 PM
    Is a query stateful in any way? My example. I have a class called GetBooksService which takes in a Singleton ApolloClient (provided by dagger). GetBooksService is also going to be provided by dagger for callers to use, and GetBooksService is pretty simple:
    //pseudocode
    returnresponse = apolloClient.query(GetBooksQUery(10)).execute()
    so GetBooksService is pretttttty thin, but is there anything stateful about it? This is important for me to know because I currently have the service marked as a
    @Singleton
    but i know marking something as a singleton thats not stateful is wasteful
    b
    • 2
    • 2
  • a

    agrosner

    02/14/2023, 7:15 PM
    hey quick question. do apolloUsedCoordinates support multiple services?
    > No matching variant of project :domain was found. The consumer was configured to find a usage of 'apollo-used-coordinates' of a component, as well as attribute 'com.apollographql.service' with value 'api' but
    but we only use the service from
    api2
    in that module.
    m
    • 2
    • 46
  • s

    Spencer

    02/16/2023, 9:08 PM
    Random question, Is there a way to stop
    CacheAndNetwork
    from emitting 2 values when the cache value and network value are the same?
    s
    • 2
    • 13
  • p

    Parijat Shah

    02/22/2023, 10:44 PM
    Any reason why Apollo client ( v3.7.4) throws ApolloNetworkException when response code is 401
    m
    • 2
    • 18
  • p

    Parijat Shah

    02/24/2023, 8:32 PM
    I start a subscription as seen in the code snippet. My understanding is that it will catch any exceptions and restart the flow but in reality , my app is crashing with the exception below.
    subscription(someSubscription).toFlow().retryWhen { t, attempt ->
        delay(attempt * attempt * 10000)
        true
    }
    java.io.EOFException: null
        at okio.RealBufferedSource.require(RealBufferedSource.kt:199)
        at okio.RealBufferedSource.readByte(RealBufferedSource.kt:209)
        at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:119)
        at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:102)
        at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:293)
        at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:195)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
    com.apollographql.apollo3.exception.ApolloNetworkException: Network error while executing onDisplayTimeUpdated
        at com.apollographql.apollo3.network.ws.WebSocketNetworkTransport$execute$$inlined$map$1$2.emit(Emitters.kt:246)
        at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
        at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
        at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87)
        at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66)
        at com.apollographql.apollo3.network.ws.WebSocketNetworkTransport$execute$3.invokeSuspend(WebSocketNetworkTransport.kt:271)
        at com.apollographql.apollo3.network.ws.WebSocketNetworkTransport$execute$3.invoke
        at com.apollographql.apollo3.network.ws.WebSocketNetworkTransport$execute$3.invoke
        at com.apollographql.apollo3.internal.FlowsKt$transformWhile$1$invokeSuspend$$inlined$collectWhile$1.emit(flows.kt:53)
        at com.apollographql.apollo3.internal.FlowsKt$transformWhile$1$invokeSuspend$$inlined$collectWhile$2.emit(flows.kt:38)
        at com.apollographql.apollo3.network.ws.WebSocketNetworkTransport$execute$$inlined$filter$1$2.emit(Emitters.kt:223)
        at kotlinx.coroutines.flow.SubscribedFlowCollector.emit
        at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl(SharedFlow.kt:383)
        at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
    m
    • 2
    • 15
  • c

    Colton Idle

    02/25/2023, 6:09 PM
    How do folks "mock" their apollo service? For example, I know retrofit has a mocking artifact. I guess since apollo uses okhttp I can just use a mock okhttp server too here and that should work? (or maybe actually i can use mock okhttp server no matter what client is actually in use 🤔 ) but yeah. how are you mocking this sort of stuff out? ideally i guess itd be nice to have some json files that match up to deterministic resopnses and just read from those files when a proper query is hit.
    m
    e
    • 3
    • 6
  • a

    agrosner

    02/25/2023, 7:18 PM
    To that note ^ - we have new schema that won’t be in the graph for awhile and we want to mock out that query only. We were thinking of using the network transport apis to intercept the request and delegate it to the test network transport when it finds a match. The schema we will include as a separate file alongside the regular schema and extend the Query type to add its query . Is this a good approach?
    m
    • 2
    • 7
  • a

    agrosner

    02/27/2023, 7:22 PM
    a question around data builders. We started using them and am running into errors like
    Don't know how to instantiate leaf URL
    We have a set of scalar adapters which are correctly fed into the databuilders. in the
    fakeResolver
    the order of operations is such:
    val leafValue = resolver.resolveLeaf(FakeResolverContext(path, id, mergedField))
              if (type is CustomScalarType) {
    the
    resolver
    itself seems to run without any knowledge of scalars in the `DefaultFakeResolver`:
    else -> {
            val type = enumTypes.find { it.name == name } ?: error("Don't know how to instantiate leaf $name")
    is this expected? I could not find anything in the docs for data builders
    m
    • 2
    • 8
  • p

    Phil Saul

    02/28/2023, 1:38 PM
    hey - I'm pretty new to using the Apollo Gradle Plugin and GraphQL. I noticed that the
    generateApolloSources
    task will generate some data classes that are exactly the same, is there a way to configure the plugin so that only one of each of these classes is generated and they are re-used in the respective queries?
    m
    a
    s
    • 4
    • 9
  • c

    Cody Roueche

    03/02/2023, 4:11 PM
    Is there a way when using the
    CacheAndNetwork
    fetch policy to know if the data coming through the flow is from cache or if it's from the network?
    m
    • 2
    • 6
  • s

    Seth Madison

    03/02/2023, 7:53 PM
    Is anybody using apollo-kotlin with JS in production? We’re seeing some pretty bad performance. Building a fairly straight forward
    Call
    takes order 45ms on a modern MBP in Chrome, and parsing parsing the response takes order 70ms. This compared with ~5ms to build the same
    Call
    and ~2ms to parse it using the JS Apollo client. Are there tricks that folks know of to improve the situation? We’re considering just using
    external
    functions that are implemented on the JS side to make the GraphQL queries.
    m
    • 2
    • 5
Powered by Linen
Title
s

Seth Madison

03/02/2023, 7:53 PM
Is anybody using apollo-kotlin with JS in production? We’re seeing some pretty bad performance. Building a fairly straight forward
Call
takes order 45ms on a modern MBP in Chrome, and parsing parsing the response takes order 70ms. This compared with ~5ms to build the same
Call
and ~2ms to parse it using the JS Apollo client. Are there tricks that folks know of to improve the situation? We’re considering just using
external
functions that are implemented on the JS side to make the GraphQL queries.
This is in 1.8.0
m

mbonnin

03/02/2023, 9:14 PM
Yikes that's no good! I was expecting some cost to all the Kotlin runtime but that's a lot... Pretty sure wasm would be faster but it's not for today just yet...
The
Call
part especially looks loooong. There's nothing crazy going on there. Feel free to open an issue and we'll investigate this
s

Seth Madison

03/02/2023, 11:33 PM
I can open a ticket in a bit. I upgraded to 1.8.10 and things look a bit better, but still probably untenable for production. The runtime is just doing crazy things. It seems like WASM is still a ways off, but I wonder if we can help get that WASI lib built out to speed things along… These screenshots give a sense of the
Call
building (and request making) process.
I put up an issue with a little sample project here https://github.com/apollographql/apollo-kotlin/issues/4728 LMK what ya’ll think of my (inelegant) idea to shell out to the JS client.
View count: 8