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

DataLoader: don't wrap an already Encodable value in AnyEncodable #91

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

AndrewSB
Copy link
Contributor

i don't understand what this extra wrap does. the value is already Encodable so it should be possible to directly encode it

i don't understand what this extra wrap does. the value is already `Encodable` so it should be possible to directly encode it
@@ -357,7 +357,7 @@ func encode(_ value: Encodable, using encoder: JSONEncoder) async throws -> Data
return string.data(using: .utf8)
} else {
return try await Task.detached {
try encoder.encode(AnyEncodable(value: value))
try encoder.encode(value)
Copy link
Owner

@kean kean Apr 25, 2024

Choose a reason for hiding this comment

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

I think AnyEncodable can now also be removed. It was probably a rudiment from one of the earlier implementations or was required by one of the earlier Swift versions – I can't remember now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there might have been a time when AnyEncodable didn't support Optionals or something

Copy link
Contributor Author

Choose a reason for hiding this comment

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

want me to remove and update this PR? or you want to do it?

Copy link
Owner

Choose a reason for hiding this comment

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

I would appreciate if you could remove it, but I can do it myself later.

Copy link
Owner

Choose a reason for hiding this comment

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

I removed it in main

@kean kean merged commit 623a3df into kean:main Apr 25, 2024
4 checks passed
@AndrewSB AndrewSB deleted the patch-1 branch April 26, 2024 00:04
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