malinajs 0.7.0-a13 → 0.7.0-a14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/malina.js +1 -1
  2. package/package.json +1 -1
  3. package/runtime.js +6 -5
package/malina.js CHANGED
@@ -6551,7 +6551,7 @@
6551
6551
  return { event, fn, rootModifier };
6552
6552
  }
6553
6553
 
6554
- const version = '0.7.0-a13';
6554
+ const version = '0.7.0-a14';
6555
6555
 
6556
6556
 
6557
6557
  async function compile(source, config = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "malinajs",
3
- "version": "0.7.0-a13",
3
+ "version": "0.7.0-a14",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "prepare": "npm run build",
package/runtime.js CHANGED
@@ -18,7 +18,7 @@ const safeCall = fn => {
18
18
 
19
19
  const safeGroupCall = list => {
20
20
  try {
21
- list.forEach(fn => fn?.());
21
+ list?.forEach(fn => fn?.());
22
22
  } catch (e) {
23
23
  __app_onerror(e);
24
24
  }
@@ -445,7 +445,7 @@ const callComponent = (context, component, option = {}, propFn, cmp, setter, cla
445
445
  const attachDynComponent = (label, exp, bind) => {
446
446
  let parentCD = current_cd;
447
447
  let active, destroyList, $cd, $dom, finalLabel = getFinalLabel(label);
448
- const destroy = () => destroyList && safeGroupCall(destroyList);
448
+ const destroy = () => safeGroupCall(destroyList);
449
449
  $onDestroy(destroy);
450
450
 
451
451
  $watch(exp, (component) => {
@@ -1040,6 +1040,7 @@ const makeEachElseBlock = (fn) => {
1040
1040
  let first, last;
1041
1041
  let destroyList = current_destroyList = [];
1042
1042
  let $cd = current_cd = cd_new();
1043
+ current_mountList = [];
1043
1044
  try {
1044
1045
  let $dom = fn();
1045
1046
  if($dom.nodeType == 11) {
@@ -1049,9 +1050,9 @@ const makeEachElseBlock = (fn) => {
1049
1050
  cd_attach2(parentCD, $cd);
1050
1051
  if(onlyChild) label.appendChild($dom);
1051
1052
  else attachBlock(label, $dom);
1053
+ safeCallMount(current_mountList, destroyList);
1052
1054
  } finally {
1053
- current_destroyList = null;
1054
- current_cd = null;
1055
+ current_destroyList = current_mountList = current_cd = null;
1055
1056
  }
1056
1057
 
1057
1058
  return () => {
@@ -1133,7 +1134,7 @@ function $$eachBlock(label, onlyChild, fn, getKey, bind, buildElseBlock) {
1133
1134
  ctx.$cd && eachCD.children.push(ctx.$cd);
1134
1135
  return;
1135
1136
  }
1136
- ctx.d && safeGroupCall(ctx.d);
1137
+ safeGroupCall(ctx.d);
1137
1138
  iterNodes(ctx.first, ctx.last, n => removedNodes.push(n));
1138
1139
  });
1139
1140