Skip to content

Commit

Permalink
Initialize components in try/catch blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
earthboundkid committed May 2, 2020
1 parent 7e5b73d commit 05cab0c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
12 changes: 11 additions & 1 deletion dist/alpine-ie11.js
Expand Up @@ -7175,8 +7175,18 @@
observer.observe(targetNode, observerOptions);
},
initializeComponent: function initializeComponent(el) {
var _this8 = this;

if (!el.__x) {
el.__x = new Component(el);
try {
el.__x = new Component(el);
} catch (err) {
window.setTimeout(function () {
_newArrowCheck(this, _this8);

throw err;
}.bind(this), 0);
}
}
},
clone: function clone(component, newEl) {
Expand Down
8 changes: 7 additions & 1 deletion dist/alpine.js
Expand Up @@ -1692,7 +1692,13 @@
},
initializeComponent: function initializeComponent(el) {
if (!el.__x) {
el.__x = new Component(el);
try {
el.__x = new Component(el);
} catch (err) {
window.setTimeout(() => {
throw err;
}, 0);
}
}
},
clone: function clone(component, newEl) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/index.js
Expand Up @@ -76,7 +76,13 @@ const Alpine = {

initializeComponent: function (el) {
if (! el.__x) {
el.__x = new Component(el)
try {
el.__x = new Component(el)
} catch (err) {
window.setTimeout(() => {
throw err;
}, 0);
}
}
},

Expand Down

0 comments on commit 05cab0c

Please sign in to comment.