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

repro: loop in watch stop #1

Closed
wants to merge 1 commit into from
Closed

Conversation

cexbrayat
Copy link
Owner

@cexbrayat cexbrayat commented Jul 30, 2020

The commit setups a component which is just:

  • displaying a price
  • recording price changes with a watcher
  • after 3 seconds we stop recording by calling the WatchStopHandle returned by watchEffect

In rc.4 this works fine.
In rc.5, it goes into a recursive loop.

  setup() {
    const price = ref(10);

    const history = ref<Array<string>>([]);
    const stopRecording = watchEffect(() => {
      history.value.push(`Price changed to ${price.value}`);
    });

    // stop recording after 3 seconds
    setTimeout(() => {
      stopRecording();
    }, 3000);

    return { price, history };
  }

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.

1 participant