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

defer: Deprecate legacyResponse #337

Conversation

calvincestari
Copy link
Member

Closes apollographql/apollo-ios#3370.

  • Deprecates legacyResponse
  • Stores the cache keys which are a result of the JSON interceptor parsing

Copy link
Contributor

@AnthonyMDev AnthonyMDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM! Crazy how little code was actually needed to do this and get such a big performance optimization. We should have done this a long time ago. Thanks so much @calvincestari!

I'm not sure why you changed the indentation styling of a bunch of the code in this PR as well. I prefer the style with params on individual lines, but since we haven't adopted an official style guideline and linter rules, I'm not going to request changes for that. That is something we really should do though 😅 .

apollo-ios/Sources/Apollo/HTTPResponse.swift Outdated Show resolved Hide resolved
apollo-ios/Sources/Apollo/IncrementalGraphQLResponse.swift Outdated Show resolved Hide resolved
@calvincestari
Copy link
Member Author

calvincestari commented Apr 17, 2024

This LGTM! Crazy how little code was actually needed to do this and get such a big performance optimization. We should have done this a long time ago.

I still need to:

  • add fast parsing tests for IncrementalGraphQLResponse
  • clean up the failing codegen tests due to warnings about an unused parameter in the incremental interceptor
  • capture performance tests of eliminating the double parsing when writing to the cache

@calvincestari calvincestari marked this pull request as ready for review April 23, 2024 21:31
}
}

private func parseIncrementalResult() throws -> (IncrementalGraphQLResult, RecordSet?) {
Copy link
Member Author

@calvincestari calvincestari Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally the parseResult and parseResultFast functions in GraphQLResult would be internal rather than the public scope they have now but that would be a potentially breaking change. These (parseIncrementalResult and parseIncrementalResultFast) are scoped minimally for now but we can always loosen that if needed.

@calvincestari calvincestari merged commit 820650c into feature/defer-execution-networking Apr 23, 2024
17 checks passed
@calvincestari calvincestari deleted the defer/deprecate-legacy-response branch April 23, 2024 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants