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

effect is running for every dependecy #874

Closed
ArielGueta opened this issue Jan 19, 2024 · 1 comment
Closed

effect is running for every dependecy #874

ArielGueta opened this issue Jan 19, 2024 · 1 comment

Comments

@ArielGueta
Copy link

ArielGueta commented Jan 19, 2024

import { signal, computed, effect, batch } from 'reactive-signal'

// Create a signal
const count = signal(0)

// Create a computed signal
const doubleCount = computed(() => count.value * 2)

// Create an effect
effect(() => {
  console.log(`Count: ${count.value}, Double Count: ${doubleCount.value}`)
})

// Update the count signal
count.value = 1;

It logs twice:

"Count: 1, Double Count: 2"

@dntzhang
Copy link
Collaborator

Thank you very much. It has been fixed in version 1.0.2

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

No branches or pull requests

2 participants