« get me outta code hell

data: WIP cached composition nonsense - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/thing.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-09 21:08:06 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-09 21:08:16 -0300
commitc4f6c41a248ba9ef4f802cc03c20757d417540e4 (patch)
treeec3c09824a1c4113635d110946c09150efeecd95 /src/data/things/thing.js
parent14329ec8eedb7ad5dcb6a3308a26686bd381ab36 (diff)
data: WIP cached composition nonsense
Diffstat (limited to 'src/data/things/thing.js')
-rw-r--r--src/data/things/thing.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/data/things/thing.js b/src/data/things/thing.js
index b1a9a802..19954b19 100644
--- a/src/data/things/thing.js
+++ b/src/data/things/thing.js
@@ -512,7 +512,7 @@ export function withResolvedReferenceList({
     throw new TypeError(`Expected notFoundMode to be filter, exit, or null`);
   }
 
-  return compositeFrom(`withResolvedReferenceList`, [
+  const composite = compositeFrom(`withResolvedReferenceList`, [
     exitWithoutDependency({
       dependency: data,
       value: [],
@@ -526,13 +526,19 @@ export function withResolvedReferenceList({
     }),
 
     {
-      mapDependencies: {list, data},
-      options: {findFunction},
-
-      compute: ({list, data, '#options': {findFunction}}, continuation) =>
-        continuation({
-          '#matches': list.map(ref => findFunction(ref, data, {mode: 'quiet'})),
-        }),
+      cache: 'aggressive',
+      annotation: `withResolvedReferenceList.getMatches`,
+      flags: {expose: true, compose: true},
+
+      compute: {
+        mapDependencies: {list, data},
+        options: {findFunction},
+
+        compute: ({list, data, '#options': {findFunction}}, continuation) =>
+          continuation({
+            '#matches': list.map(ref => findFunction(ref, data, {mode: 'quiet'})),
+          }),
+      },
     },
 
     {
@@ -569,6 +575,9 @@ export function withResolvedReferenceList({
       },
     },
   ]);
+
+  console.log(composite.expose);
+  return composite;
 }
 
 // Check out the info on reverseReferenceList!