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

Add OnMountAndIf condition to effect hook #47

Merged
merged 4 commits into from
Jan 13, 2020

Conversation

glennsl
Copy link
Collaborator

@glennsl glennsl commented Nov 7, 2019

Fixes #27

Is this simple enough that you can verify it by eye, or do you want tests for certain conditions?

I added OnMountAndIf instead of "fixing" If since this isn't a breaking change on the type level and therefore might lead to some very subtle bugs when upgrading.

lib/Hooks.re Outdated
ignore(executeOptionalHandler(cleanupHandler));
executeOptionalHandler(cleanupHandler);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Luckily this had just been made unnecessary, but it might have been a bug if for example an argument had been added to cleanupHandler that resulted in a partial application. Especially in a call that is pure side-effect. To prevent bugs like that I always use let _: callback = ... or |> (ignore: callback => unit) instead of naked ignores or let _ = ....

And yes, this has actually bitten me before. It's not just theoretical 😁

@wokalski wokalski merged commit 34e5991 into briskml:master Jan 13, 2020
@wokalski
Copy link
Member

🙌

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.

If Hook is not fired on mount
2 participants