-
Notifications
You must be signed in to change notification settings - Fork 57
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
Conversation
✅ Deploy Preview for apollo-ios-docc canceled.
|
✅ Deploy Preview for eclectic-pie-88a2ba canceled.
|
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
2ab4500e fix: `legacyResponse` property (#456) git-subtree-dir: apollo-ios git-subtree-split: 2ab4500ebc61a11a7c5344f1d7a3f4999aea4eab
git-subtree-dir: apollo-ios git-subtree-mainline: ae99271 git-subtree-split: 2ab4500ebc61a11a7c5344f1d7a3f4999aea4eab
When the
legacyResponse
property ofHTTPResponse
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.