Skip to content

Conversation

calvincestari
Copy link
Member

This is related to apollographql/apollo-ios#3579 but targets a fix in the 1.0 branch.

An Optional type wrapped by AnyHashable exhibits weird behaviour when checking equality of a non-optional type, eg: Swift == Swift?. The fix in 1.x is to recover the type data lost through using AnyHashable in DataDict and then cast the field data as the field's concrete type for equality checks.

Copy link

netlify bot commented Sep 24, 2025

Deploy Preview for apollo-ios-docc canceled.

Name Link
🔨 Latest commit c3d36ac
🔍 Latest deploy log https://app.netlify.com/projects/apollo-ios-docc/deploys/68dd76ccaf4e40000885d32f

@apollo-librarian
Copy link

apollo-librarian bot commented Sep 24, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 3 changed, 0 removed
* (developer-tools)/ios/v1/client-directives.mdx
* (developer-tools)/ios/v1/caching/cache-key-resolution.mdx
* (developer-tools)/ios/v1/caching/programmatic-cache-keys.mdx

Build ID: f2e31548e29f16e8906b2e12
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/f2e31548e29f16e8906b2e12

@calvincestari calvincestari marked this pull request as draft September 25, 2025 20:04
@calvincestari calvincestari marked this pull request as ready for review September 29, 2025 21:44
__data[key]
}

public static func == (lhs: MockSelectionSet, rhs: MockSelectionSet) -> Bool {
Copy link
Member Author

Choose a reason for hiding this comment

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

SelectionSet now has it's own equality implementation.

@calvincestari calvincestari changed the base branch from main to v1 October 1, 2025 19:41
@calvincestari calvincestari force-pushed the fix/v1-equality-check branch from 52a7915 to 893a4f5 Compare October 1, 2025 22:10
@calvincestari calvincestari force-pushed the fix/v1-equality-check branch from 87a2466 to ab8f785 Compare October 7, 2025 19:19
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.

Minor unit test suggestion

}
}

@_disfavoredOverload
Copy link
Contributor

Choose a reason for hiding this comment

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

I accidentally left this in when I was trying something else. We can remove the @_disfavoredOverload here

await fulfillment(of: [updateCompletedExpectation], timeout: 1.0)
}

func test__equatable__givenFailingModelFromCI_sameValue_shouldBeEqual() throws {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should change the name of this to what it's actually testing, which I'm pretty sure is list of nested entities. We could probably remove the irrelevant fields also.

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