Skip to content

Commit 0d7106d

Browse files
committed
prevent cascading component init failure
If one init function throws, the others are still launched fixes #513
1 parent 31165d4 commit 0d7106d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

sqlpage/sqlpage.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,15 @@ function load_scripts() {
186186
}
187187
}
188188

189-
function add_init_function(f) {
189+
function add_init_fn(f) {
190190
document.addEventListener('DOMContentLoaded', f);
191191
document.addEventListener('fragment-loaded', f);
192-
if (document.readyState !== "loading") f();
192+
if (document.readyState !== "loading") setTimeout(f, 0);
193193
}
194194

195-
add_init_function(function init_components() {
196-
sqlpage_table();
197-
sqlpage_map();
198-
sqlpage_card();
199-
sqlpage_form();
200-
load_scripts();
201-
});
195+
196+
add_init_fn(sqlpage_table);
197+
add_init_fn(sqlpage_map);
198+
add_init_fn(sqlpage_card);
199+
add_init_fn(sqlpage_form);
200+
add_init_fn(load_scripts);

0 commit comments

Comments
 (0)