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

Improve the second example in the read write same scope warning #3374

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/signals/src/warnings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fn app() -> Element {
let mut count2 = use_signal(|| 0);

use_effect(move || {
count1.write(count2());
count1.set(count2());
});
}
2) Reading and Writing to the same signal in different scopes:
Expand All @@ -134,7 +134,7 @@ fn app() -> Element {
use_effect(move || {
// This effect both reads and writes to count
println!("{}", count());
count.write(count());
count.set(1);
});
}

Expand All @@ -145,7 +145,7 @@ fn app() -> Element {
let mut count = use_signal(|| 0);

use_effect(move || {
count.write(count());
count.set(1);
});
use_effect(move || {
println!("{}", count());
Expand Down
Loading