« get me outta code hell

data: handle missing expose specially in base - 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-09-09 18:20:00 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-09 18:32:06 -0300
commit272a2f47102451a277d099d032e6f4d0ad673d80 (patch)
treee7241f13bb7b327c6c31f8f797669c04dd4c7714
parentcaf2ade89b827f5245875f8194f78ebb2661e61e (diff)
data: handle missing expose specially in base
This is for better compatibility with an updating base that doesn't
transform its update value, but attempts to behave reasonably for
non-transforming contexts as well.
-rw-r--r--src/data/things/composite.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/data/things/composite.js b/src/data/things/composite.js
index 2dd92f1..3a63f22 100644
--- a/src/data/things/composite.js
+++ b/src/data/things/composite.js
@@ -603,7 +603,31 @@ export function compositeFrom(firstArg, secondArg) {
           : step);
 
       if (!expose) {
-        debug(() => `step #${i+1} - no expose description, nothing to do for this step`);
+        if (!isBase) {
+          debug(() => `step #${i+1} - no expose description, nothing to do for this step`);
+          continue;
+        }
+
+        if (expectingTransform) {
+          debug(() => `step #${i+1} (base) - no expose description, returning so-far update value:`, valueSoFar);
+          if (continuationIfApplicable) {
+            debug(() => colors.bright(`end composition - raise (inferred - composing)`));
+            return continuationIfApplicable(valueSoFar);
+          } else {
+            debug(() => colors.bright(`end composition - exit (inferred - not composing)`));
+            return valueSoFar;
+          }
+        } else {
+          debug(() => `step #${i+1} (base) - no expose description, nothing to continue with`);
+          if (continuationIfApplicable) {
+            debug(() => colors.bright(`end composition - raise (inferred - composing)`));
+            return continuationIfApplicable();
+          } else {
+            debug(() => colors.bright(`end composition - exit (inferred - not composing)`));
+            return null;
+          }
+        }
+
         continue;
       }