VueJS 2 and Vue Resource - Chrome Crashes (infinite loop?)

858 views Asked by At

Using VueJS2 with vue-resource

Building a trait for handling CRUD functions.

My model data is stored in data at key selectedClientModel (for example), and so, the component that uses this Trait defines the key to store the data ie >>

this.dataModel = "selectedClientModel";

and sets the resourceUri appropriately. ie>>

this.resourceUri = "/api/admin/clients";

So, the Trait is below.....

    updateModel() {
        var vm = this;
        var model = this.$data[this.dataModel];
        this.$http.put(this.resourceUri + '/' + model.id, model).then(function(response) {
            alert('success');
        }, function (response) {
            alert('failure');
        });
    },

When I run this, chrome crashes, so I installed FF for Devs and found the following:

InternalError: too much recursion
Stack trace:
reactiveGetter@http://oriondas.app/js/retailer-orders.js line 103 > eval:1101:11
_merge@http://oriondas.app/js/retailer-orders.js line 230 > eval:413:1
_merge@http://oriondas.app/js/retailer-orders.js line 230 > eval:420:13
_merge@http://oriondas.app/js/retailer-orders.js line 230 > eval:420:13
...

At line 103 is:

eval("/*!\n * Vue.js v2.0.3\n * (c) 2014-2016 Evan You\n * Released under the MIT License.\n */\n(function (global, factory) {\n   true ? module.exports = factory() :\n  typeof define === 'function' && define.amd ? define(factory) :\n  (global.Vue = fac .......

At line 230 is:

eval("/*!\n * vue-resource v1.0.3\n * https://github.com/vuejs/vue-resource\n * Released under the MIT License.\n */\n\n'use strict';\n\n/**\n * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)\n */\n\nvar RESOLVED = 0;\nvar REJECTED = 1;\nvar PENDING = 2;\n\nfunction Promise$1(executor) {\n\n    this.state = PENDING;\n    this.value = undefined;\n    this.deferred = [];\n\n    var promise = this;\n\n    try {\n        executor(function (x) {\n            promise.resolve(x);\n        }, fu .....

I have no idea why this is turning into an infinite loop... any help would be greatly appreciated.

(FYI, I am using Vue-resource for create and delete and they work perfectly fine....)

0

There are 0 answers