LeeR LeeR - 1 year ago 115
Javascript Question

ractivejs.push() returning object.keys error in IE11

I have an issue that I can't seem to figure out. I'm using ractiveJS for a DNS management system I'm building.

I'm trying to add a new record to the end of the existing records. I'm using

to retrieve the current records. I'm then building a new object

var thisRecord = {};
thisRecord.hostname = "hostname";
thisRecord.ip = "";

I'm then using
to add it to ractiveJS. In Chrome, Firefox and Safari, this works fine, in IE11, I'm getting the following error coming back.

IE11 Ractive JS Error

Just a note. Even though it's in file auth.js, that file is just a compressed file with a few other files within. The affected line seems to be in RactiveJS and this is the line

return n.isRoot?o=[].concat(Object.keys(t.viewmodel.data),Object.keys(t.viewmodel.mappings),Object.keys(t.viewmodel.computations)):(i=t.viewmodel.wrapped[n.str],r=i?i.get():t.viewmodel.get(n),o=r?Object.keys(r):null),o&&o.forEach(function(t){"_ractive"===t&&s(r)||e.push(n.join(t))}),e

Any ideas would be appreciated!


I've found out this issue is only in Ractive 0.7.3, the behaviour works as expected in < 0.7.3 and in Ractive 0.8.5, pushing an object into Ractive as above doesn't update the model at all.

Answer Source

I couldn't find an answer anywhere as no one seems to be having this issue. Upgrading to RactiveJS 0.8.5 seems to have fixed the issue, although had to do a bit more work to make other things work again...

Seems 0.7.3 to 0.8.5 had some breaking changes done, which can found here docs.ractivejs.org/0.8/migrating

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download