« get me outta code hell

data: Thing.composite.from bugfixes - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-08-25 13:28:29 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-05 21:02:51 -0300
commit2a87cbaf06e364585bae2b48919c46b6d1f7aa1f (patch)
treeff64c1ef974af810e6fa48babf608e1aeae35443
parentba1cf3fe611661c85ef4a7150c924f99e1e94ba3 (diff)
data: Thing.composite.from bugfixes
-rw-r--r--src/data/things/thing.js18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/data/things/thing.js b/src/data/things/thing.js
index 555e443d..16dd786d 100644
--- a/src/data/things/thing.js
+++ b/src/data/things/thing.js
@@ -922,7 +922,7 @@ export default class Thing extends CacheableObject {
           return {continuation, continuationStorage};
         }
 
-        function _computeOrTransform(value, initialDependencies) {
+        function _computeOrTransform(value, initialDependencies, continuationIfApplicable) {
           const dependencies = {...initialDependencies};
 
           let valueSoFar = value;         // Set only for {update: true} compositions
@@ -1020,15 +1020,11 @@ export default class Thing extends CacheableObject {
 
             return result;
           } else if (base.flags.compose) {
-            const {continuation, continuationStorage} = _prepareContinuation(transform, base.expose);
+            const {continuation, continuationStorage} = _prepareContinuation(false, base.expose);
 
             debug(() => `base - compute with dependencies: ${inspect(filteredDependencies, {depth: 0})}`);
 
-            const result =
-              base.expose.compute(filteredDependencies, providedDependencies => {
-                exportDependencies = providedDependencies;
-                return continuationSymbol;
-              });
+            const result = base.expose.compute(filteredDependencies, continuation);
 
             if (result !== continuationSymbol) {
               throw new TypeError(`Use continuation.exit() or continuation.raise() in {compose: true} composition`);
@@ -1069,12 +1065,12 @@ export default class Thing extends CacheableObject {
 
         if (base.flags.update) {
           expose.transform =
-            (value, initialDependencies) =>
-              _computeOrTransform(value, initialDependencies);
+            (value, initialDependencies, continuationIfApplicable) =>
+              _computeOrTransform(value, initialDependencies, continuationIfApplicable);
         } else {
           expose.compute =
-            (initialDependencies) =>
-              _computeOrTransform(noTransformSymbol, initialDependencies);
+            (initialDependencies, continuationIfApplicable) =>
+              _computeOrTransform(noTransformSymbol, initialDependencies, continuationIfApplicable);
         }
       }