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

Made the hooks async by default #63

Conversation

daniel-deboeverie-lemon
Copy link
Contributor

No description provided.

@olexale
Copy link
Owner

olexale commented Feb 10, 2024

Thanks for the proposed changes. Would you please describe in a bit more details why you believe Future would be a better choice?

@daniel-deboeverie-lemon
Copy link
Contributor Author

99 percent of use cases for hooks I could think of require you to await something.
The main point of this pr was to make the methods async by default, since you don't want to always have to change that, and awaiting an async method that is actually sync in implementation has no drawback.
We could change it back to using FutureOr instead, but I would keep the default addition of the async modifier to the methods

@olexale
Copy link
Owner

olexale commented Feb 11, 2024

99 percent of use cases for hooks I could think of require you to await something.

That's an interesting observation. I'd say all initializations and/or preparations in my widget tests are synchronous. However, I don't use Hooks myself as steps composition works well for all my cases, so maybe I'm missing something.

I believe it is better for the users to have synchronous behavior as the default. At least that what I would generally suggest to any developer without knowing their context — keep it simpler, as it is always easy to change it when needed.

Do you see any other drawbacks of keeping the existing solution, except of annoying need of adding the async modifier?

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