Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exploring Apollo iOS: Feature Parity with Web Client, Cache Updates, and Development Roadmap #3479

Closed
Vincz opened this issue Nov 25, 2024 · 3 comments
Labels
question Issues that have a question which should be addressed

Comments

@Vincz
Copy link

Vincz commented Nov 25, 2024

Question

I'm a long time user of Apollo Web client and I'm currently trying the IOS client for the first time.
I'm trying to achieve the corresponding features:

  • Update cache to insert/delete an item in a collection after a mutation (I haven't been able to find documentation about that. It was mentioned here , but it was more than 1 year ago).

  • Optimistic mutation response to increase responsiveness.

  • Time base expiration for cache

  • With the web client, I'm used to query a few fields from an object and a few more later with another query while manipulating the same object. The object simply gets updated with the new fields after it has been requested.
    For example:

type Item {
    id: ID!
    field1: String
    field2: String
    field3: String // Very expensive to compute
}

type Query {
    getItem(id: ID!): Item
}

And my operations would be:

query getItemBase($id: ID!) {
    symbol: getItem(id: $id) {
        id
        field1
        field2
    }
}

query getItemDetails($id: ID!) {
    symbol: getItem(id: $id) {
        id
        field3
    }
}

Calling the first operation, then the second would result on an item containing the Id and all 3 fields (the resulting object would be a "merge"). I'm trying to do the same but It doesn't seem possible as the resulted object is strongly typed with only the fields requested from the fragment.

Lastly, I was wondering if the library is still currently being developed or just maintained (It seems that in the past few months, there have only been a few fixes.). If it is, is there some sort of roadmap so we know what the future holds?
I've been able to found these one: #1701 but it seems abandoned and some pending features are almost 8 years old.

Thanks!

@Vincz Vincz added the question Issues that have a question which should be addressed label Nov 25, 2024
@calvincestari
Copy link
Member

Hi @Vincz 👋🏻

Update cache to insert/delete an item in a collection after a mutation (I haven't been able to find documentation about that. It was mentioned here, but it was more than 1 year ago).

I just replied to you question in that issue. I don't believe there is any documentation specifically about list insertion, no.

Optimistic mutation response to increase responsiveness.

I think you're talking about this feature in Apollo Client and here in Apollo Kotlin? Apollo iOS does not have an equivalent feature at the moment. The Apollo iOS cache has a far more limited feature set than the other two libraries.

Time base expiration for cache

Another no unfortunately.

With the web client, I'm used to query a few fields from an object and a few more later with another query while manipulating the same object. The object simply gets updated with the new fields after it has been requested.

You're able to update the same object in the cache by normalizing objects by cache key but that doesn't change the shape of the operation response object. As you noted the generated Swift models are strongly typed to only the fields in the operation/fragment. I think if you wanted to do this you would need to create your own Swift model with all the object's fields and manually fetch that from the cache by id.

Lastly, I was wondering if the library is still currently being developed or just maintained (It seems that in the past few months, there have only been a few fixes.). If it is, is there some sort of roadmap so we know what the future holds?
I've been able to found these one: #1701 but it seems abandoned and some pending features are almost 8 years old.

Yes, the library is still being actively developed, and our roadmap is public.

From your questions it looks like you're mostly interested in cache behaviour which as you can see from the old issues and placement in the roadmap, is not high on the priority list. Version 1.0 was all about achieving stability in code generation and expanding that feature set. Version 2.0 is about Swift 6 compatibility and bringing Swift Concurrency to the library. The cache will be updated in a future major version some time beyond that.

@calvincestari calvincestari closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2024
Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.

@Vincz
Copy link
Author

Vincz commented Nov 25, 2024

Thank you very much for all the clarification @calvincestari!
I'm sorry I'm missed the roadmap.
I'll dive a little bit more in the library!
Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issues that have a question which should be addressed
Projects
None yet
Development

No branches or pull requests

2 participants