Mathbl
12/04/2023, 2:02 PMStylianos Gakis
12/05/2023, 8:28 PMExperimental @oneOf support
released in latest beta release, the backend would also need to know how this works right? Are there already some backend implementations that “know” how to work with it atm?Stylianos Gakis
12/07/2023, 4:26 PMwatch
on a query, smth like this
apolloClient.query(MyQuery)
.fetchPolicy(FetchPolicy.CacheOnly)
.watch(true, true) // also tried with `watch(true, true)` etc.
.onEach {
logcat { "watchMessages: #1" }
}
.retryWhen { cause, _ ->
cause is CacheMissException ||
(cause is ApolloCompositeException && cause.suppressedExceptions.any { it is CacheMissException })
}
...
I was testing the “I have no internet at all” scenario here and I have turned off wifi + data completely, and it seems to just never emit anything, which I am not sure I understand why. It never reaches the first onEach to log #1
In the scenario where there’s nothing in the cache, should it not at least either throw a CacheMissException
or just emit an empty list or something like that?
If there is already something in the cache, should it not just try and emit what was in the cache already?
And I made sure that there is no problem with the flow itself never turning hot by doing smth silly like
return flow {
logcat { "watchMessages: #0.5" }
emitAll(<the snippet above>)
}
and #0.5 is printed correctly, so for sure the flow starts.S.
12/10/2023, 10:57 PMObject 'DeckOrError:*UUID*' not found
.
I have a typePolicy on Deck
with it's id and I can see that those are being stored in the cache, however it's fields are never getting retrieved from the cache.
I also set up a fieldPolicy extend type Deck @fieldPolicy(forField: "cards", keyArgs: "afterId limit sortBy")
but same story - it's being cached but never retrieved and resulting in the above not-found message.
It only works for the top-level getUser -> userDecks query, which says Object 'QUERY_ROOT' has no field named 'getUser'
only the first time, subsequent calls are fetched from the cache.
What can be done, or what am I missing to make the cache work properly? it's not even possible to apply extensions on the union type itselfElliot Murray
12/11/2023, 12:30 PMdebug
endpoint and a release
endpoint and have a service set up for each. Each schema is then downloaded to a separate source set location, and the queries are in the main
source set, so shared with both variants.
The idea here is the debug schema can be updated (e.g. a new field has been added) before the release schema, and I can update the queries to include this new field. Ideally then I'd like the debug version to still compile, but the release to fail due to the missing field, until that change is pushed to the release endpoint/the release schema is updated also.
The issue I'm seeing with this however, is when I build the debug version the generateReleaseApolloSources
task is also run, and that fails the build because the field doesn't exist yet in the release schema. Is there any way around this issue? I'm new to GraphQL so appreciate I may be aiming at the incorrect solution here! Thanks 🙂John O'Reilly
12/13/2023, 5:26 PMCacheMissException
in StarWars sample (https://github.com/joreilly/StarWars) after moving to v4 (didn't notice when I updated at time as it was using cache I believe)....version in repo is 4.0.0-alpha.2
but see same issue with beta-4. It could be some migration step missing perhaps but just in case any obvious things to look out for? More in 🧵Stylianos Gakis
12/15/2023, 1:48 PMsortedBy
myself, but would be good to understand how the cache determines the ordering itself.Marco Pierucci
01/08/2024, 11:08 AMFrank Sullivan
01/11/2024, 10:44 PMemitCacheMisses
(which I think is enabled by default in 4 but we're still on 3.8) and then looking at the timing info in the cacheInfo
execution context. I haven't yet figured out a way to time cache writes though.Kaanixir
01/15/2024, 1:27 AMmutation
which includes a fragment model inside, something like:
query getX($deviceBla: ID!) {
getX(deviceBla: $deviceBla) {
...getY
}
}
and getY is something like:
fragment getY on X
I'm trying to feed a manually generated response from the Apollo Mock Server back to the Apollo Client.
In original prod, without the mock server, the entire response on getX returns with getY fragment being replaced with it's inner fields. So getY 's Y class fields gets merged onto X response model
But the Query Model itself in kotlin, via adapter, is generated as
Data(getX) : Query.Data
public data class GetX(__typename: String, val getY: Y)
so if I build the response via response builders, or if I build it myself, I end up having to initialise the Y inside getX's response model, and JSON ends up having the key value for Y, when in reality key value for Y is not supposed to be there because fragment replaces the class with it's inner fields and merges it into the upper parent.
How can we manually or via response_builders, generate a more complex graphql response like this ? the only difference is Y's inner field methods are merged onto the parent model, I thought this would be easy to achieve, or I expected response builders to intelligently tackle thisPeter
01/15/2024, 5:16 PMFrank Sullivan
01/25/2024, 4:26 PM@cache
directive in the schema maybe? But I'm not finding official docs on it. Does the ApolloClient do anything with the @cacheControl
directive?KaaN
02/06/2024, 12:16 AMApollo Kotlin runtime
4.0.0-beta.4
? every time I synchronise it's stuck on Loading Apollo Kotlin configuration
for a loooong time, it takes like 10 minutes as a gradle task by itself, although most compilation tasks are finished way earlier than thisStylianos Gakis
02/08/2024, 9:49 PMCacheAndNetworkInterceptor
and I see that it says "An interceptor that emits the response from the cache first, and then emits the response(s) from the network.".
And I wonder, when will the response(s)
actually be plural here? When does the network return more than one response when we're just doing a Query and not a Subscription?Frank Sullivan
02/14/2024, 10:21 PMSets the FetchPolicy used when watching queries and a cache change has been publishedI just want to see if I understand the behavior. So when the cached data changes, the ApolloStore is going to publish a list of the changed keys. When you watch a Query, and it sees the relevant keys have been changed, it has to make a decision about how to emit the updated data. The default (CacheOnly) will simply try to read the query from the cache. But if we changed it to (say) NetworkOnly, then it would make a network call every time relevant keys changed, and so on with the other Fetch Policies? And normally any errors would be eaten up but I can have them thrown instead by setting
refetchThrows=true
?Sean Proctor
02/17/2024, 3:09 PMStylianos Gakis
02/17/2024, 5:13 PM[Contract!]!
.
In my case, I actually am only interested in the size of that list for this particular situation. Because I just wanna know if there are any contracts.
Then on my .graphql file, I got this
...
activeContracts {
id
}
...
but I am getting unused field
on the id, since well... I am not in fact using it 😄
There's no notion of just fetching a list without anything in there in GQL right? Is my best bet to just add # noinspection ApolloUnusedField
over the id
to not get a warning?KaaN
02/21/2024, 12:03 AMsnowe
02/22/2024, 6:40 PM{
"errors": [
{
"errorType": "UnknownOperationException",
"message": "Unknown Operation Request."
}
]
}
brandonmcansh
02/28/2024, 2:00 AMFrank Sullivan
02/29/2024, 10:50 PMApolloStore#writeFragment
. Can this be used to update the cache if an object has changed? E.g. let's say I have a Widget
object with id=8675309
and so it has a cache key of (say) Widget:8675309
. This Widget is shared by multiple queries. If I make a Mutation to this widget, and I know the cache key, can I use writeFragment
to update the cache manually? (this is for a situation where the back end can't return the updated data)John O'Reilly
03/01/2024, 11:12 AM0.6.0-RC
version and getting what looks like crash in apollo on iOS.....more in threadStylianos Gakis
03/08/2024, 3:38 PMtype Flow {
id: ID!
currentStep: FlowStep!
progress: FlowProgress
context: FlowContext!
}
I wanted to build an interceptor to simply observe any request that may ever return Flow
, and take the currentStep
from inside of it to log it for some specific reasons. Does this sound possible?Seb Jachec
03/12/2024, 3:24 PMgenerateServiceApolloSources
task is failing with java.lang.NullPointerException (no error message)
when I run a Gradle project sync after I've downloaded a changed schema and fixed a number of errors in my query/mutation files. Does anyone have any suggestions as to how I can work out what's going wrong? The full exception didn't feel very helpful (see thread)rudolf.hladik
03/15/2024, 10:41 AMNSPrivacyAccessedAPICategoryFileTimestamp
NSPrivacyAccessedAPICategorySystemBootTime
NSPrivacyAccessedAPICategoryUserDefaults
NSPrivacyAccessedAPICategoryDiskSpace
Is there a chance that it is used by apollo? as we do not use these APIswasyl
03/27/2024, 10:11 AMquery Foo {
bar { baz }
}
the builders allow me to write
Foo.Builder {
bar = buildBar {
someUnrelatedPropertyInBar = ""
// I'm allowed to leave `baz` unset
}
}
is that right or I'm missing something? Is there a way for a less flexible API, one that mirrors the queries and would give a typesafe way to build a json for a given data (one that forces me to pass the fetched fields, and doesn't allow passing fields that aren't fetched)?wasyl
04/02/2024, 3:51 PMApollo-AST
artifact and I can read and parse graphql executable document and schema just fine 👌 But I can't figure out what's the proper way to grab a selection type. For query variables I can see type
field with stuff like GQLNonNullType(GQLNamedType(name = ID))
, but for e.g. fragment selections I only see a name.
I can extract a type manually via (schema.typeDefinitions[fragmentTypeCondition.name] as GQLObjectTypeDefinition).fields[fragmentField.name]
, just wondering if I'm not unnecessarily complicating thingsStylianos Gakis
04/10/2024, 1:46 PMEduard Boloș
04/15/2024, 6:04 PMUNKNOWN__
, meaning that now we can't switch that enum to use a sealed class in Kotlin, because of the name clash between the object and the class 🤦 What would be the easiest/fastest way to change the generated classes' name to something else, to avoid the conflict? Is a compiler hook the only way?Stylianos Gakis
04/19/2024, 7:50 AM@null
directive?
We have a field which was wrongly marked as non-null on the schema, but really it should just be null for various reasons. One way is to deprecate that one and add a second one, and keep the old one around for old clients so that we make a forwards compatible change. That works fine.
I was thinking could we go the other way around, and mark it as nullable on our clients for now, in preparation for the future. Then in X time forward, we can go and make the breaking change in the backend, turning it nullable, and by that time we will make sure that we have kill-switched all old clients, something we do anyway on some intervals for other reasons which are unrelated to this, but would help in scenarios like this.
I can for now go on and edit the final result of the ApolloDownloadSchemaTask
task, which would work too, but I am just curious if there was any previous discussion on this idea in general that I would find interesting to read.