apollographql / apollo-kotlin

:rocket:  A strongly-typed, caching GraphQL client for the JVM, Android, and Kotlin multiplatform.
https://www.apollographql.com/docs/kotlin
MIT License
3.77k stars 656 forks source link

`@loading` directive, similar to Houdini #5925

Open kansson opened 6 months ago

kansson commented 6 months ago

Use case

Data loading can be simplified with loading states.

Describe the solution you'd like

The idea comes from https://github.com/HoudiniGraphQL/houdini and can be used as a reference for implementation. See https://houdinigraphql.com/guides/loading-states#defining-the-shape for relevant docs.

BoD commented 6 months ago

Hi! Thanks for reaching out.

This is an interesting idea. I could see this especially useful with @defer where different parts of the received model can have been received or not yet (currently modeled as null). Not 100% sure of the benefits in other cases, where (if I understand correctly) @loading fields will either be all loading, or all filled at the same time. Don't hesitate to add more context / examples to illustrate how this could be helpful in Kotlin/Compose.