Skip to content

Update Infinite Re-computation Issue in useFetch Composable Example #2473

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

Conversation

spaden
Copy link
Contributor

@spaden spaden commented Aug 12, 2023

Description of Problem

https://vuejs.org/guide/reusability/composables.html#accepting-reactive-state

The watchEffect should not modify data.value and error.value used in this example to avoid infinite re-computations.

Modifying data.value and error.value within watchEffect has the potential to trigger infinite re-renders.
@netlify
Copy link

netlify bot commented Aug 12, 2023

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit e8c0c9c
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/64d778eb2866040007d5f1d3
😎 Deploy Preview https://deploy-preview-2473--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@spaden spaden changed the title Fix Infinite Re-render Issue in useFetch Composable Example Update Infinite Re-render Issue in useFetch Composable Example Aug 12, 2023
@spaden spaden changed the title Update Infinite Re-render Issue in useFetch Composable Example Update Infinite Re-computation Issue in useFetch Composable Example Aug 12, 2023
@NataliaTepluhina NataliaTepluhina merged commit ced311c into vuejs:main Sep 20, 2023
@andrewvasilchuk
Copy link
Contributor

@NataliaTepluhina please, correct me if I'm wrong, but modifying a ref value is not tracked by watchRef. Only reading of a ref value is tracked. Here is the playground link which proves it.

Skatox added a commit to Skatox/vuejs-spanish-docs that referenced this pull request Mar 30, 2024
Modifying data.value and error.value within watchEffect has the potential to trigger infinite re-renders.
Skatox added a commit to Skatox/vuejs-spanish-docs that referenced this pull request Apr 8, 2024
Modifying data.value and error.value within watchEffect has the potential to trigger infinite re-renders.
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