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
Introduce use_future_with_deps #2615
Conversation
Oops, I didn't want to request a review immediately @hamza1311 There's still a few things to improve before then. |
Visit the preview URL for this PR (updated for commit cd056b5): https://yew-rs-api--pr2615-use-future-with-deps-obllg21z.web.app (expires Sun, 24 Apr 2022 09:10:45 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Size Comparison
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think use_future(|| async { ... })
is equivalent to use_future_with_deps(|_| async { ... }, ())
.
Maybe these 2 hooks should be merged?
This would bring this hook to be more inline with use_memo
and lead to a smaller codebase.
(Performance penalty of comparing ()
should be very minimal.)
I don't see how this is different from |
use_effect without specifying deps runs on every render (as if the deps changes every time) and |
@WorldSEnder |
At least for now, the |
Description
Fill the remaining gap from #2609 and introduce
use_future_with_deps
.I'll finish the remaining tasks such as docs and better tests tomorrow, just wanted to show that it's possible.
Checklist
cargo make pr-flow