@sigx/terminal 0.1.14 → 0.1.16

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