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

Adds support for custom equality checks on unwrap #123

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

pirelenito
Copy link
Member

Simple extension of the existing useFacetUnwrap API, allowing passing an optional extra argument to perform custom equality checks.

As its an optional argument, this is not breaking the current API contract.

@pirelenito pirelenito requested review from a team and vb and removed request for a team June 12, 2023 15:10
const demoFacet = createFacet({ initialValue: value })

// Dummy equality check that always returns its not equal
const check = jest.fn().mockReturnValue(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also test for equal cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

The goal of the test was to be able to validate that the check itself was being used, as the actual comparison (or usage of the check) is done within the createFacet function.

@pirelenito pirelenito merged commit 7105eff into main Jun 15, 2023
@pirelenito pirelenito deleted the unwrap-equality-check branch June 15, 2023 14:11
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