[Vuejs]-Vue 2 Laravel 5.3 Infinte Update Loop

0👍

You are updating the vue instance data variable carts in the updated hooks and as docs says: updated hook is called after a data change causes the virtual DOM to be re-rendered and patched. So you are in a infinite loop: you change the vue data it updates the the DOM and call the updated block which again change the data.

This is also mention in the docs:

you can perform DOM-dependent operations in this hook. However, in most cases you should avoid changing state in this hook, because it may lead to an infinite update loop.

You can see this circle in the below vue instance lifecycle diagram.

enter image description here

Leave a comment