mol_wire_lib 1.0.1508 → 1.0.1510

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.
package/node.mjs CHANGED
@@ -176,11 +176,11 @@ var $;
176
176
  function $mol_dev_format_button(label, click) {
177
177
  return $mol_dev_format_auto({
178
178
  [$.$mol_dev_format_head]() {
179
- return $mol_dev_format_span({ color: 'cornflowerblue' }, label);
179
+ return $.$mol_dev_format_span({ color: 'cornflowerblue' }, label);
180
180
  },
181
181
  [$.$mol_dev_format_body]() {
182
182
  Promise.resolve().then(click);
183
- return $mol_dev_format_span({});
183
+ return $.$mol_dev_format_span({});
184
184
  }
185
185
  });
186
186
  }
@@ -202,7 +202,7 @@ var $;
202
202
  return $mol_dev_format_native(val);
203
203
  }
204
204
  if (val instanceof Error) {
205
- return $mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
205
+ return $.$mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
206
206
  }
207
207
  if (val instanceof Promise) {
208
208
  return $.$mol_dev_format_shade($mol_dev_format_native(val), ' ', val[Symbol.toStringTag] ?? '');
@@ -274,28 +274,23 @@ var $;
274
274
  ];
275
275
  }
276
276
  $.$mol_dev_format_element = $mol_dev_format_element;
277
- function $mol_dev_format_span(style, ...content) {
278
- return $mol_dev_format_element('span', {
279
- ...style,
280
- }, ...content);
281
- }
282
- $.$mol_dev_format_span = $mol_dev_format_span;
277
+ $.$mol_dev_format_span = $mol_dev_format_element.bind(null, 'span');
283
278
  $.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
284
279
  $.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
285
280
  $.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
286
281
  $.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
287
282
  $.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
288
283
  $.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
289
- $.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
284
+ $.$mol_dev_format_accent = $.$mol_dev_format_span.bind(null, {
290
285
  'color': 'magenta',
291
286
  });
292
- $.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
287
+ $.$mol_dev_format_strong = $.$mol_dev_format_span.bind(null, {
293
288
  'font-weight': 'bold',
294
289
  });
295
- $.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
290
+ $.$mol_dev_format_string = $.$mol_dev_format_span.bind(null, {
296
291
  'color': 'green',
297
292
  });
298
- $.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
293
+ $.$mol_dev_format_shade = $.$mol_dev_format_span.bind(null, {
299
294
  'color': 'gray',
300
295
  });
301
296
  $.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
@@ -1660,15 +1655,22 @@ var $;
1660
1655
  return function $mol_wire_task_get(host, args) {
1661
1656
  const sub = $mol_wire_auto();
1662
1657
  const existen = sub?.track_next();
1658
+ let cause = '';
1663
1659
  reuse: if (existen) {
1664
1660
  if (!existen.temp)
1665
1661
  break reuse;
1666
- if (existen.host !== host)
1662
+ if (existen.task !== task) {
1663
+ cause = 'task';
1667
1664
  break reuse;
1668
- if (existen.task !== task)
1665
+ }
1666
+ if (existen.host !== host) {
1667
+ cause = 'host';
1669
1668
  break reuse;
1670
- if (!$mol_compare_deep(existen.args, args))
1669
+ }
1670
+ if (!$mol_compare_deep(existen.args, args)) {
1671
+ cause = 'args';
1671
1672
  break reuse;
1673
+ }
1672
1674
  return existen;
1673
1675
  }
1674
1676
  const key = (host?.[Symbol.toStringTag] ?? host) + ('.' + task.name + '<#>');
@@ -1676,11 +1678,11 @@ var $;
1676
1678
  if (existen?.temp) {
1677
1679
  $$.$mol_log3_warn({
1678
1680
  place: '$mol_wire_task',
1679
- message: `Non idempotency`,
1681
+ message: `Different ${cause} on restart`,
1680
1682
  sub,
1681
- pubs: [...sub?.pub_list ?? [], existen],
1683
+ prev: existen,
1682
1684
  next,
1683
- hint: 'Ignore it',
1685
+ hint: 'Maybe required additional memoization',
1684
1686
  });
1685
1687
  }
1686
1688
  return next;
package/node.test.js CHANGED
@@ -167,11 +167,11 @@ var $;
167
167
  function $mol_dev_format_button(label, click) {
168
168
  return $mol_dev_format_auto({
169
169
  [$.$mol_dev_format_head]() {
170
- return $mol_dev_format_span({ color: 'cornflowerblue' }, label);
170
+ return $.$mol_dev_format_span({ color: 'cornflowerblue' }, label);
171
171
  },
172
172
  [$.$mol_dev_format_body]() {
173
173
  Promise.resolve().then(click);
174
- return $mol_dev_format_span({});
174
+ return $.$mol_dev_format_span({});
175
175
  }
176
176
  });
177
177
  }
@@ -193,7 +193,7 @@ var $;
193
193
  return $mol_dev_format_native(val);
194
194
  }
195
195
  if (val instanceof Error) {
196
- return $mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
196
+ return $.$mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
197
197
  }
198
198
  if (val instanceof Promise) {
199
199
  return $.$mol_dev_format_shade($mol_dev_format_native(val), ' ', val[Symbol.toStringTag] ?? '');
@@ -265,28 +265,23 @@ var $;
265
265
  ];
266
266
  }
267
267
  $.$mol_dev_format_element = $mol_dev_format_element;
268
- function $mol_dev_format_span(style, ...content) {
269
- return $mol_dev_format_element('span', {
270
- ...style,
271
- }, ...content);
272
- }
273
- $.$mol_dev_format_span = $mol_dev_format_span;
268
+ $.$mol_dev_format_span = $mol_dev_format_element.bind(null, 'span');
274
269
  $.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
275
270
  $.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
276
271
  $.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
277
272
  $.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
278
273
  $.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
279
274
  $.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
280
- $.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
275
+ $.$mol_dev_format_accent = $.$mol_dev_format_span.bind(null, {
281
276
  'color': 'magenta',
282
277
  });
283
- $.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
278
+ $.$mol_dev_format_strong = $.$mol_dev_format_span.bind(null, {
284
279
  'font-weight': 'bold',
285
280
  });
286
- $.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
281
+ $.$mol_dev_format_string = $.$mol_dev_format_span.bind(null, {
287
282
  'color': 'green',
288
283
  });
289
- $.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
284
+ $.$mol_dev_format_shade = $.$mol_dev_format_span.bind(null, {
290
285
  'color': 'gray',
291
286
  });
292
287
  $.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
@@ -1651,15 +1646,22 @@ var $;
1651
1646
  return function $mol_wire_task_get(host, args) {
1652
1647
  const sub = $mol_wire_auto();
1653
1648
  const existen = sub?.track_next();
1649
+ let cause = '';
1654
1650
  reuse: if (existen) {
1655
1651
  if (!existen.temp)
1656
1652
  break reuse;
1657
- if (existen.host !== host)
1653
+ if (existen.task !== task) {
1654
+ cause = 'task';
1658
1655
  break reuse;
1659
- if (existen.task !== task)
1656
+ }
1657
+ if (existen.host !== host) {
1658
+ cause = 'host';
1660
1659
  break reuse;
1661
- if (!$mol_compare_deep(existen.args, args))
1660
+ }
1661
+ if (!$mol_compare_deep(existen.args, args)) {
1662
+ cause = 'args';
1662
1663
  break reuse;
1664
+ }
1663
1665
  return existen;
1664
1666
  }
1665
1667
  const key = (host?.[Symbol.toStringTag] ?? host) + ('.' + task.name + '<#>');
@@ -1667,11 +1669,11 @@ var $;
1667
1669
  if (existen?.temp) {
1668
1670
  $$.$mol_log3_warn({
1669
1671
  place: '$mol_wire_task',
1670
- message: `Non idempotency`,
1672
+ message: `Different ${cause} on restart`,
1671
1673
  sub,
1672
- pubs: [...sub?.pub_list ?? [], existen],
1674
+ prev: existen,
1673
1675
  next,
1674
- hint: 'Ignore it',
1676
+ hint: 'Maybe required additional memoization',
1675
1677
  });
1676
1678
  }
1677
1679
  return next;