@sigx/terminal 0.1.13 → 0.1.14

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/dist/index.js CHANGED
@@ -40,9 +40,13 @@ function trigger(depSet) {
40
40
  function runEffect(fn) {
41
41
  const effectFn = function() {
42
42
  cleanup(effectFn);
43
+ const prevEffect = activeEffect;
43
44
  activeEffect = effectFn;
44
- fn();
45
- activeEffect = null;
45
+ try {
46
+ fn();
47
+ } finally {
48
+ activeEffect = prevEffect;
49
+ }
46
50
  };
47
51
  effectFn.deps = [];
48
52
  effectFn();
@@ -1027,14 +1031,18 @@ function lazy(loader) {
1027
1031
  if (!promise) promise = loader().then((mod) => {
1028
1032
  Component = "default" in mod ? mod.default : mod;
1029
1033
  state = "resolved";
1030
- loadState.state = "resolved";
1031
- loadState.tick++;
1034
+ batch(() => {
1035
+ loadState.state = "resolved";
1036
+ loadState.tick++;
1037
+ });
1032
1038
  return Component;
1033
1039
  }).catch((err) => {
1034
1040
  error = err instanceof Error ? err : new Error(String(err));
1035
1041
  state = "rejected";
1036
- loadState.state = "rejected";
1037
- loadState.tick++;
1042
+ batch(() => {
1043
+ loadState.state = "rejected";
1044
+ loadState.tick++;
1045
+ });
1038
1046
  throw error;
1039
1047
  });
1040
1048
  if (state === "resolved" && Component) return () => {