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

fix: legacyResponse property #456

Merged
merged 2 commits into from
Aug 8, 2024
Merged

Conversation

calvincestari
Copy link
Member

@calvincestari calvincestari commented Aug 7, 2024

When the legacyResponse property of HTTPResponse was deprecated setting the value was also removed; this was incorrect as it created a hidden breaking change for interceptors that might have been using the value.

The value cannot simply be set though, as it was before, because of Swift's inability to disable the deprecation warning. Instead there is now an internal property that stores the legacy response value and legacyResponse becomes a computed property that simply forwards the new internal property value.

The cacheRecords property that was added to eliminate the need to re-parse the legacy response has also been made public for interceptors that need cache records and do not want to have to parse the response a second time.

Copy link

netlify bot commented Aug 7, 2024

Deploy Preview for apollo-ios-docc canceled.

Name Link
🔨 Latest commit 9940a43
🔍 Latest deploy log https://app.netlify.com/sites/apollo-ios-docc/deploys/66b40125c0451f00085ff8b4

Copy link

netlify bot commented Aug 7, 2024

Deploy Preview for eclectic-pie-88a2ba canceled.

Name Link
🔨 Latest commit 9940a43
🔍 Latest deploy log https://app.netlify.com/sites/eclectic-pie-88a2ba/deploys/66b4012565f0a1000842ebbe

Copy link
Member

@BobaFetters BobaFetters left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -101,14 +101,15 @@ public struct IncrementalJSONResponseParsingInterceptor: ApolloInterceptor {
}
}

createdResponse._legacyResponse = nil
Copy link
Member Author

@calvincestari calvincestari Aug 7, 2024

Choose a reason for hiding this comment

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

I think this is the correct action to take here. There is nothing to set it to other than nil because this code path is for incremental responses. I think leaving the initial (partial) response in _legacyResponse is also incorrect because it doesn't match the result being returned. The 'legacy' part of the response logic could also be argued to mean pre-defer-support in which case nil again seems the correct choice.

@calvincestari calvincestari merged commit 7e053b8 into main Aug 8, 2024
38 checks passed
@calvincestari calvincestari deleted the fix/legacy-response-cache-records branch August 8, 2024 22:34
BobaFetters pushed a commit that referenced this pull request Aug 8, 2024
BobaFetters pushed a commit to apollographql/apollo-ios that referenced this pull request Aug 8, 2024
BobaFetters pushed a commit that referenced this pull request Aug 8, 2024
2ab4500e fix: `legacyResponse` property (#456)

git-subtree-dir: apollo-ios
git-subtree-split: 2ab4500ebc61a11a7c5344f1d7a3f4999aea4eab
BobaFetters pushed a commit that referenced this pull request Aug 8, 2024
git-subtree-dir: apollo-ios
git-subtree-mainline: ae99271
git-subtree-split: 2ab4500ebc61a11a7c5344f1d7a3f4999aea4eab
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