Skip to content

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

Merged
kean merged 1 commit intokean:mainfrom
AndrewSB:patch-1
Apr 25, 2024
Merged

DataLoader: don't wrap an already Encodable value in AnyEncodable#91
kean merged 1 commit intokean:mainfrom
AndrewSB:patch-1

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
} 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
@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