Medium Android App — Migrating from Apollo Kotlin 3 to 4: Lessons Learned
The migration of the Medium Android app from Apollo Kotlin 3 to 4 involved overcoming cache-related challenges, implementing declarative cache IDs, and improving error handling to enhance the GraphQL implementation's performance and robustness.
MAIN POINTS
- Migration from Apollo Kotlin 3 to 4 exposed cache configuration issues.
- Declarative cache IDs replaced programmatic ones to improve cache matching.
- Exception handling was updated to align with Apollo 4's new approach.
- Future improvements include HTTP batching and persisted queries for better performance.
TAKEAWAYS
- Apollo Kotlin 4's changes require revisiting caching strategies for optimal performance.
- Declarative cache IDs simplify cache key generation and improve cache hit rates.
- Proper exception handling ensures meaningful error reporting to the UI.
- Implementing HTTP batching and persisted queries can further enhance network efficiency.