yschimke
04/08/2023, 10:10 AMyschimke
04/08/2023, 10:15 AMmbonnin
04/08/2023, 10:22 AMJohn O'Reilly
04/08/2023, 10:23 AMJohn O'Reilly
04/08/2023, 10:27 AMJohn O'Reilly
04/08/2023, 10:47 AMMarcello Galhardo
04/08/2023, 12:25 PMFetchPolicy.CacheAndNetwork
by default (based on the PR above, I think it is now the default parameter)? I'm asking because that was raising a crash during my tests (not sure why, but @mbonnin knows it).mbonnin
04/08/2023, 12:26 PMCacheAndNetwork
because:
• it doesn't work with execute()
as it can produce 2 responses
• it changes the UI without user actionmbonnin
04/08/2023, 12:27 PMMarcello Galhardo
04/08/2023, 12:28 PMThe operation returned multiple items, use .toFlow() instead of .execute()
mbonnin
04/08/2023, 12:32 PM.execute()
to toFlow()
and uses flow operators to hide errors upstream (see ClientQuery.kt)mbonnin
04/08/2023, 12:33 PMCacheAndNetwork
mbonnin
04/08/2023, 12:49 PMclient.query(query).fetchPolicy(CacheFirst).execute()
2. Two-items: client.query(query).fetchPolicy(CacheAndNetwork).toFlow()
3. Ongoing flow (never terminates): client.query(query).watch()
mbonnin
04/08/2023, 1:00 PMRepository
for ? Right now it's just a class that centralizes all calls to ApolloClient
but doesn't have a lot of logicyschimke
04/08/2023, 1:06 PMRight now it's just a class that centralizes all calls toI'm ok with this, or removing it because everyone just submits GraphQL queries. I want to avoid a separate layer, and hope we can mostly push down the complexity onto Apollo. Screens just define the queries the need to get data.but doesn't have a lot of logicApolloClient
yschimke
04/08/2023, 1:09 PMI'm pretty much againstbecause:CacheAndNetwork
• it doesn't work withas it can produce 2 responsesexecute()
• it changes the UI without user actionI'm against it for other reasons. The two responses are fine, because you don't know if the network is going to work, so if you want fresh data (which the mobile originally did) then it's good to show immediate results from the cache, but then refresh. I think dealing with a Flow in your UIs is common, and it's way harder to start with suspend forms like execute(). But I'm against it, because I think this app is a great candidate for an offline first app, relying on Apollo to do the right thing.
mbonnin
04/08/2023, 1:10 PMI think dealing with a Flow in your UIs is common, and it's way harder to start with suspend forms like execute().yea, fair point
mbonnin
04/08/2023, 1:11 PMScreens just define the queries the need to get data.That works for queries that ultimately terminate. Not for
watch()
yschimke
04/08/2023, 1:11 PMyschimke
04/08/2023, 1:12 PMThat works for queries that ultimately terminate. Not forIf I read watch() it seems like it doesn't hit the network, just keeps in sync with the local cache, is that correct?watch()
mbonnin
04/08/2023, 1:12 PMmbonnin
04/08/2023, 1:12 PMmbonnin
04/08/2023, 1:12 PMmbonnin
04/08/2023, 1:13 PMmbonnin
04/08/2023, 1:13 PMmbonnin
04/08/2023, 1:14 PMthen it's good to show immediate results from the cache, but then refresh.I have mixed feeling about this. It's okay if the data doesn't change too much but the twitter example is a good example of weird behaviour when you're reading a tweet that suddendly disappears. This is infuriating to me
mbonnin
04/08/2023, 1:15 PMyschimke
04/08/2023, 1:19 PMmbonnin
04/08/2023, 1:21 PMmbonnin
04/08/2023, 1:22 PMmbonnin
04/08/2023, 1:23 PMJohn O'Reilly
04/08/2023, 1:24 PMJohn O'Reilly
04/08/2023, 1:25 PMJohn O'Reilly
04/08/2023, 1:28 PMmbonnin
04/08/2023, 1:29 PMmbonnin
04/08/2023, 1:29 PMmbonnin
04/08/2023, 1:30 PMmbonnin
04/08/2023, 1:30 PMmbonnin
04/08/2023, 1:30 PMJohn O'Reilly
04/08/2023, 1:30 PMJohn O'Reilly
04/08/2023, 1:31 PMmbonnin
04/08/2023, 1:31 PMmbonnin
04/08/2023, 1:31 PMmbonnin
04/08/2023, 1:31 PMJohn O'Reilly
04/08/2023, 1:31 PMJohn O'Reilly
04/08/2023, 1:34 PMyschimke
04/08/2023, 4:21 PMyschimke
04/08/2023, 4:21 PMyschimke
04/08/2023, 4:22 PM