Explorar o código

wrap final saferEval with tryCatch

Hugo Di Francesco %!s(int64=4) %!d(string=hai) anos
pai
achega
3c68ef1ac9
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/component.js

+ 2 - 1
src/component.js

@@ -390,7 +390,8 @@ export default class Component {
                 if (! (closestParentComponent && closestParentComponent.isSameNode(this.$el))) continue
 
                 if (mutations[i].type === 'attributes' && mutations[i].attributeName === 'x-data') {
-                    const rawData = saferEval(mutations[i].target.getAttribute('x-data') || '{}', { $el: this.$el })
+                    const xAttr = mutations[i].target.getAttribute('x-data') || '{}';
+                    const rawData = tryCatch(() => saferEval(xAttr, { $el: this.$el }), { el: this.$el, xAttr })
 
                     Object.keys(rawData).forEach(key => {
                         if (this.$data[key] !== rawData[key]) {