-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
use_future_with: simplify code a bit by using read-only use_memo rather than use_state #3610
Conversation
…er than use_state
e447fd9
to
8deac09
Compare
Visit the preview URL for this PR (updated for commit a3f3bb5): https://yew-rs-api--pr3610-simplify-use-future-59ezrwnp.web.app (expires Sat, 10 Aug 2024 20:40:48 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Benchmark - coreYew Master
Pull Request
|
Size Comparison
✅ None of the examples has changed their size significantly. |
Benchmark - SSRYew Master
Pull Request
|
It looks like CI is broken in ways most likely unrelated to this PR? |
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.
Simple yet effective.
The feature linting failures come from know extra lints that got introduced at some point that we haven't gotten around to fix yet.
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.
With #3548 this could actually be even simpler: use_raw_ref(|| Cell::new(0u32))
Yup, sounds like it could get even simpler! But I'll probably have completely forgotten about this once #3548 lands, so… 😅 |
@WorldSEnder Should we just land this, or do you want to wait for #3548 to land before? |
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.
@WorldSEnder I made the change for use_ref as well
Description
Slight code simplification: here
latest_id
is never used as mutable, so might as well make it non-mutable by usinguse_memo_base
Checklist
There was no relevant test to add for this code simplification