Skip to content

Conversation

Jackbar
Copy link

@Jackbar Jackbar commented Sep 13, 2020

I noticed that the computed module has been changed recently. pull 1458.
But I tested and found that there was a problem with this change, but I am not sure whether my test is correct.

const count = ref(0);
const plusOne = computed(() => {
  return count.value + 1;
});
effect(() => {
  console.log(plusOne.value + count.value);
});
function plus() {
  count.value++
}
plus();
// result
// 1
// 3
// 3

I changed the operation in the effect, the result was different.

const count = ref(0);
const plusOne = computed(() => {
  return count.value + 1;
});
effect(() => {
  console.log(count.value + plusOne.value);
});
function plus() {
  count.value++
}
plus();
// result
// 1
// 2
// 3

I think the priority of computedRunners is higher than effects.

@dsonet
Copy link
Contributor

dsonet commented Sep 14, 2020

I think it actually doesn't matter. Because in the end the value is correct.

@yyx990803
Copy link
Member

This is stale and should no longer be necessary.

@yyx990803 yyx990803 closed this Jul 15, 2021
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.

3 participants