-
Notifications
You must be signed in to change notification settings - Fork 55
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
Vue error when domDelay is set to true, when modifying array. #19
Comments
Thank you for the clean re-pro examples! I'll dive into this issue either tomorrow or this weekend and see what I can figure out. Off the top of my head, it sounds to me like Vue might be making additional mutations to the target object after the initial mutation. When In general, I'd expect that Vue models won't play very nice with ObservableSlim -- especially Arrays. In order to observe mutations on plain objects, Vue 2 uses Vue 3 will ship with a Proxy-based observer ( https://medium.com/the-vue-point/plans-for-the-next-iteration-of-vue-js-777ffea6fabf ) which might resolve the issues you've encountered. |
Elliot, you made me realize I probably don't need to Observe my vue model directly. I can use a separate simple data model and directly modify the vue model from my handler. As long as both models have a matching initial starting value, they should transform the same. Really loving ObservableSlim so far! Edit |
Glad to hear that you were able to find a workaround! I haven't had a chance to dive deep into this issue yet, but it's still on my to-do list. |
When using ObservableSlim on a Vue.js data model, I'm running into a vue error when domDelay is enabled & you don't make changes right away.
See this gist for a series of tests: https://gist.github.com/BinarySpike/aa4f82fd024265b72fcde1327c7b0f09
Ultimately I got it working (test7), but it seems ObservableSlim is doing something that Vue doesn't like (test5), even when I've called
pauseChanges
and don't mutate the object myself (test6).Below are the three issues I ran into.
Array
andArray.push
will fail in the same operation/batchArray.push
will generate a vue error.My troubleshooting and intuition leads me to believe Vue is queuing/batching changes like ObservableSlim. Directly after creating the ObservableSlim, if you make changes, they are performed before Vue "wires-up." However, once Vue completes it's initial operations something is funky. It has something to do with the way ObservableSlim resolves/calls
Array.push
because direct access (test8) works fine.I think test7 will work for my immediate needs, but I would like to know if there are solutions to problems 2 and 3.
The text was updated successfully, but these errors were encountered: